| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450 |
- <template>
- <ele-modal
- custom-class="ele-dialog-form long-dialog-form"
- :centered="true"
- v-if="visible"
- :visible.sync="visible"
- :title="title"
- :close-on-click-modal="false"
- width="70%"
- @close="cancel"
- :maxable="true"
- :resizable="true"
- append-to-body
- >
- <el-form
- ref="form"
- :model="form"
- :rules="rules"
- class="el-form-box"
- label-width="120px"
- >
- <headerTitle title="订单信息"></headerTitle>
- <el-row>
- <el-col :span="8">
- <el-form-item label="订单类型" prop="sourceType">
- <el-select
- v-model="form.sourceType"
- placeholder="请选择"
- style="width: 100%"
- @change="sourceTypeChange"
- :disabled="isFlag || (isUpdate && form.sourceType === '8')"
- clearable
- >
- <el-option
- v-for="item in filterList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="需求部门" prop="requireDeptId">
- <ele-tree-select
- clearable
- :data="groupTreeData"
- v-model="form.requireDeptId"
- valueKey="id"
- labelKey="name"
- placeholder="请选择"
- @change="change_principalDep"
- default-expand-all
- />
- </el-form-item>
- <el-form-item label="采购部门" prop="purchaseDeptId">
- <ele-tree-select
- clearable
- :data="groupTreeData"
- v-model="form.purchaseDeptId"
- valueKey="id"
- labelKey="name"
- placeholder="请选择"
- @change="changePurchaseDep"
- default-expand-all
- />
- </el-form-item>
- <el-form-item label="来源类型" prop="relationType">
- <el-select
- v-model="form.relationType"
- filterable
- clearable
- style="width: 100%"
- :disabled="(isUpdate && form.sourceType === '8')"
- @change="handleChangeRelationType"
- >
- <el-option v-if="!showReturnRelation" :value="1" label="采购需求单"></el-option>
- <el-option v-if="!showReturnRelation" :value="2" label="采购计划单"></el-option>
- <el-option v-if="!showReturnRelation" :value="3" label="采购核价单"></el-option>
- <el-option v-if="!showReturnRelation" :value="4" label="采购合同"></el-option>
- <el-option v-if="!showReturnRelation" :value="5" label="售后服务"></el-option>
- <el-option v-if="showReturnRelation" :value="6" label="销售退货单"></el-option>
- <el-option v-if="showReturnRelation" :value="7" label="销售退货处理单"></el-option>
- <el-option v-if="showReturnRelation" :value="8" label="采购退货单"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- prop="outsourceScene"
- label="委外场景"
- v-if="
- orderSourceType.includes(form.sourceType) && form.outsourceScene
- "
- >
- <el-select
- v-model="form.outsourceScene"
- disabled
- style="width: 100%"
- >
- <el-option
- :value="item.value"
- :label="item.label"
- v-for="item in outsourceSceneList"
- :key="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- v-if="form.relationType == 1"
- label="采购需求单"
- prop="relationName"
- >
- <el-input
- @click.native="handPurchaseNeed"
- v-model="form.relationName"
- placeholder="请选择"
- ></el-input>
- </el-form-item>
- <el-form-item
- v-if="form.relationType == 2"
- label="采购计划单"
- prop="relationName"
- >
- <el-input
- @click.native="handPurchasePlan"
- v-model="form.relationName"
- placeholder="请选择"
- ></el-input>
- </el-form-item>
- <el-form-item
- v-if="form.relationType == 3"
- label="采购核价单"
- prop="relationName"
- >
- <el-input
- @click.native="handInquiry"
- v-model="form.relationName"
- placeholder="请选择"
- ></el-input>
- </el-form-item>
- <el-form-item
- v-if="form.relationType == 4"
- label="选择合同"
- prop="contractName"
- >
- <el-input
- clearable
- v-model="form.contractName"
- @click.native="handleContractBtn"
- @clear="clearContrcat"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- v-if="form.relationType == 6"
- label="销售退货单"
- prop="relationName"
- >
- <el-input
- clearable
- v-model="form.relationName"
- @click.native="handleReturnBtn"
- @clear="clearContrcat"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- v-if="form.relationType == 7"
- label="销售退货处理单"
- prop="relationName"
- >
- <el-input
- clearable
- v-model="form.relationName"
- :disabled="(isUpdate && form.sourceType === '8')"
- @click.native="handleReturnDealBtn"
- @clear="clearContrcat"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item
- v-if="form.relationType == 8"
- label="采购退货单"
- prop="relationName"
- >
- <el-input
- clearable
- v-model="form.relationName"
- @click.native="handlePurchaseReturnOrder"
- @clear="clearContrcat"
- placeholder="请输入"
- />
- </el-form-item>
-
- </el-col>
- <el-col :span="8">
- <!-- <el-form-item label="项目名称" prop="projectName">
- <el-input
- clearable
- v-model="form.projectName"
- placeholder="请输入"
- />
- </el-form-item> -->
- <el-form-item label="项目名称" prop="projectName">
- <el-input
- clearable
- v-model="form.projectName"
- placeholder="请输入"
- style="width: calc(100% - 80px)"
- />
- <el-button
- style="margin-left: 5px"
- size="small"
- type="primary"
- @click.native="handleProjectBtn"
- >选择
- </el-button>
- </el-form-item>
-
- <el-form-item label="需求人" prop="requireUserId">
- <personSelect
- ref="directorRef"
- v-model="form.requireUserId"
- @selfChange="salesmanChange"
- :init="false"
- />
- </el-form-item>
- <el-form-item label="采购员" prop="purchaseUserId">
- <personSelect
- ref="purchaseDirectorRef"
- v-model="form.purchaseUserId"
- @selfChange="purchaseUserChange"
- :init="false"
- />
- </el-form-item>
- <el-form-item label="签订日期" prop="contractStartDate">
- <el-date-picker
- v-model="form.contractStartDate"
- type="date"
- value-format="yyyy-MM-dd"
- format="yyyy-MM-dd"
- :clearable="false"
- placeholder="选择日期"
- style="width: 100%"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item prop="orderFiles" label="附件">
- <fileMain v-model="form.orderFiles"></fileMain>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="交易方式" prop="transactionMode">
- <el-select
- v-model="form.transactionMode"
- placeholder="请选择"
- @change="transactionModeChange"
- style="width: 100%"
- >
- <el-option
- v-for="item in transactionMethodsOp"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="收货模式" prop="deliveryMode">
- <el-select
- v-model="form.deliveryMode"
- placeholder="请选择"
- disabled
- @change="deliveryModeChange"
- style="width: 100%"
- >
- <el-option
- v-for="item in shippingModePurchaseOp"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="结算方式" prop="settlementMode">
- <DictSelection
- dictName="结算方式"
- clearable
- @itemChange="settlementModeChange"
- v-model="form.settlementMode"
- >
- </DictSelection>
- </el-form-item>
- <el-form-item v-if="form.settlementMode == 1" label="结算日期范围" prop="settlementDate">
- <!-- <el-date-picker
- v-model="form.contractStartDate"
- @change="setDeliveryDays"
- type="date"
- placeholder="选择日期"
- style="width: 100%"
- >
- </el-date-picker> -->
- <el-date-picker
- style="width: 100%"
- v-model="form.settlementDate"
- :clearable="false"
- type="daterange"
- value-format="yyyy-MM-dd"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- @change="settlementDateChange">
- </el-date-picker>
- </el-form-item>
- <el-form-item v-if="form.settlementMode == 2" label="结算月份范围" prop="settlementDate">
- <!-- <el-date-picker
- v-model="form.contractEndDate"
- type="date"
- placeholder="选择日期"
- style="width: 100%"
- >
- </el-date-picker> -->
- <el-date-picker
- v-model="form.settlementDate"
- type="monthrange"
- :clearable="false"
- range-separator="至"
- start-placeholder="开始月份"
- end-placeholder="结束月份"
- value-format="yyyy-MM"
- style="width: 100%"
- @change="settlementDateChange"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item v-if="form.settlementMode == 2" label="收款日期" prop="receiptDate">
- <el-input type="number" :min="1" :max="31" placeholder="请输入" v-model="form.receiptDate" @input="receiptDateChange">
- <template slot="prepend">每月</template>
- <template slot="append">日</template>
- </el-input>
- </el-form-item>
- <el-form-item
- label="期数"
- prop="issueNumber"
- >
- <el-input type="number" :min="1" v-model="form.issueNumber" @input="issueNumberChange">
- <template slot="append">
- <span>期</span>
- </template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <headerTitle title="基本信息"></headerTitle>
- <el-row>
- <el-col :span="12">
- <el-form-item label="采购方名称" prop="partaName">
- <el-select
- style="width: 100%"
- v-model="form.partaName"
- placeholder="请选择"
- @change="getEnterprise()"
- >
- <el-option
- v-for="item in enterprisePage"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="采购方统一社会信用代码"
- class="form_item_label"
- prop="partaUnifiedSocialCreditCode"
- >
- <el-input
- clearable
- v-model="form.partaUnifiedSocialCreditCode"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="采购方联系人" prop="partaLinkName">
- <el-input
- clearable
- v-model="form.partaLinkName"
- @click.native="handHead"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="采购方电话" prop="partaTel">
- <el-input
- clearable
- :maxlength="20"
- v-model="form.partaTel"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="采购方传真" prop="partaFax">
- <el-input clearable v-model="form.partaFax" placeholder="请输入" />
- </el-form-item>
- <el-form-item label=" 采购方Email" prop="partaEmail">
- <el-input
- clearable
- v-model="form.partaEmail"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="采购方地址" prop="partaAddress">
- <el-input
- clearable
- v-model="form.partaAddress"
- placeholder="请输入"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="供应商名称" prop="partbName">
- <el-row>
- <el-col :span="form.partbName ? 19 : 24">
- <el-input
- clearable
- v-model="form.partbName"
- @click.native="handParent"
- :disabled="!!form.contractId"
- placeholder="请选择"
- >
- </el-input>
- </el-col>
- <el-col :span="5">
- <el-button
- v-if="form.partbName"
- style="color: #fff; background: #1890ff"
- @click.native="handleGoodsList"
- >供货列表
- </el-button>
- </el-col>
- </el-row>
- </el-form-item>
- <el-form-item
- label="供应商统一社会信用代码"
- prop="partbUnifiedSocialCreditCode"
- class="form_item_label"
- >
- <el-input
- clearable
- v-model="form.partbUnifiedSocialCreditCode"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="供应商联系人" prop="partbLinkName">
- <el-select
- style="width: 100%"
- v-model="form.partbLinkName"
- placeholder="请选择"
- @change="onchangeLink"
- >
- <el-option
- v-for="item in linkNameOptions"
- :key="item.id"
- :label="item.linkName"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item prop="partbTel" label="供应商联系电话">
- <el-input clearable v-model="form.partbTel" placeholder="请输入" />
- </el-form-item>
- <el-form-item prop="partbFax" label="供应商传真">
- <el-input clearable v-model="form.partbFax" placeholder="请输入" />
- </el-form-item>
- <el-form-item label="供应商Email" prop="partbEmail">
- <el-input
- clearable
- v-model="form.partbEmail"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="供应商地址" prop="partbAddress">
- <el-input
- clearable
- v-model="form.partbAddress"
- placeholder="请输入"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <!-- <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle> -->
- <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
- <el-tab-pane label="物品清单" name="1">
- <inventoryTable
- ref="inventoryTable"
- @orderDiscountAmount="orderDiscountAmount"
- :pricingWay="form.pricingWay"
- :supplierMark="form.supplierMark"
- :is-show-supplier-mark="true"
- :isContractId="
- !!form.contractId && !OutValidate.includes(form.sourceType)
- "
- :isBatchNo="isBatchNo == 1"
- :showSaleCount="true"
- @getProductData="getSupplierData"
- >
- </inventoryTable>
- </el-tab-pane>
- <el-tab-pane
- label="带料清单"
- name="2"
- v-if="orderSourceType.includes(form.sourceType)"
- >
- <inventoryTable
- ref="rawDetailListRef"
- :detailType="1"
- :pricingWay="form.pricingWay"
- :supplierMark="form.supplierMark"
- :is-show-supplier-mark="true"
- cacheKeyUrl="eos-purchasingManage-purchaseOrder-inventoryTable1"
- :isContractId="
- !!form.contractId && !OutValidate.includes(form.sourceType)
- "
- ></inventoryTable>
- </el-tab-pane>
- <el-tab-pane
- label="产出清单"
- name="3"
- v-if="orderSourceType.includes(form.sourceType)"
- >
- <inventoryTable
- ref="outputDetailListRef"
- :detailType="2"
- :pricingWay="form.pricingWay"
- :supplierMark="form.supplierMark"
- cacheKeyUrl="eos-purchasingManage-purchaseOrder-inventoryTable2"
- :is-show-supplier-mark="true"
- :isContractId="
- !!form.contractId && !OutValidate.includes(form.sourceType)
- "
- ></inventoryTable>
- </el-tab-pane>
- </el-tabs>
- <el-row style="margin-top: 20px">
- <el-col :span="12">
- <el-form-item label="总金额" prop="totalAmount">
- {{ allcountAmount || 0 }}元
- </el-form-item>
- <el-form-item label="备注" prop="remark">
- <el-input
- clearable
- type="textarea"
- v-model="form.remark"
- placeholder="请输入"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="优惠后总金额" prop="payAmount">
- <el-input
- clearable
- v-model="form.payAmount"
- :disabled="
- (!!form.contractId && !OutValidate.includes(form.sourceType)) ||
- !allcountAmount
- "
- type="number"
- @blur="discountInput"
- placeholder="请输入"
- >
- <template slot="append">元</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <headerTitle
- title="付款计划"
- style="margin-top: 30px"
- ></headerTitle>
- <PaymentCollectionPlan
- ref="paymentCollectionPlanRef"
- menu="purchase"
- :info="form"
- @getIssueNumber="setIssueNumber"
- ></PaymentCollectionPlan>
- </el-form>
- <div slot="footer" class="footer">
- <el-button type="primary" @click="save" v-click-once>保存</el-button>
- <el-button type="primary" @click="save('sub')" v-click-once
- >提交</el-button
- >
- <el-button @click="cancel">返回</el-button>
- </div>
- <parentList
- ref="parentRef"
- @changeParent="changeParent"
- :classType="2"
- ></parentList>
- <head-list ref="headRef" @changeParent="changePersonel"></head-list>
- <contractListDialog
- :hasGeneratedOrder="
- this.OutValidate.includes(this.form.sourceType) ? 3 : 0
- "
- ref="selectContractRef"
- @changeParent="changeContract"
- :type="2"
- :sourceType="form.sourceType"
- ></contractListDialog>
- <inquiryManageList
- ref="inquiryManageRef"
- @changeInquiryManageList="changeInquiryManageList"
- ></inquiryManageList>
- <process-submit-dialog
- :isNotNeedProcess="true"
- :processSubmitDialogFlag.sync="processSubmitDialogFlag"
- v-if="processSubmitDialogFlag"
- ref="processSubmitDialogRef"
- @reload="reload"
- ></process-submit-dialog>
- <purchaseNeedList
- ref="purchaseNeedList"
- @changeParent="changePurchaseNeedList"
- ></purchaseNeedList>
- <inquiryList
- ref="inquiryListRef"
- @changeParent="changeInquiryList"
- ></inquiryList>
- <supplier-goods-list-dialog
- @changeParent="changeValue"
- :supplier-goods-list-dialog-flag.sync="supplierGoodsListDialogFlag"
- v-if="supplierGoodsListDialogFlag"
- ref="supplierGoodsListDialogRef"
- ></supplier-goods-list-dialog>
- <planTableList
- ref="planTableListRef"
- @success="putTableValue"
- @contractSuccess="contractSuccess"
- ></planTableList>
- <projectListDialog
- ref="selectProjectRef"
- @changeParent="changeProject"
- ></projectListDialog>
- <!-- 销售退货 -->
- <return-order-dialog
- :returnOrderDialogFlag.sync="returnOrderDialogFlag"
- returnSourceType=""
- hasHandleReceipt=""
- types=""
- v-if="returnOrderDialogFlag"
- @changeParent="changeReturn"
- >
- </return-order-dialog>
- <!-- 销售处理退货 -->
- <returnOrderDealDialog
- :returnOrderDealDialogFlag.sync="returnOrderDealDialogFlag"
- v-if="returnOrderDealDialogFlag"
- @changeParent="changeReturnDeal"
- >
- </returnOrderDealDialog>
- <!-- 采购退货 -->
- <purchase-return-order-dialog
- :purchaseReturnOrderDialogFlag.sync="purchaseReturnOrderDialogFlag"
- v-if="purchaseReturnOrderDialogFlag"
- @changeParent="getPReturnOrderInfo"
- ref="returnOrderDialogRef"
- ></purchase-return-order-dialog>
- <ele-modal
- custom-class="ele-dialog-form long-dialog-form"
- :visible.sync="supplierListShow"
- title="选择供应商"
- :close-on-click-modal="false"
- width="600px"
- append-to-body
- >
- <el-select style="width: 100%" v-model="supplierId" placeholder="请选择">
- <el-option
- v-for="item in supplierList"
- :key="item.supplierId"
- :label="item.supplierName"
- :value="item.supplierId"
- >
- </el-option>
- </el-select>
- <div slot="footer" class="footer">
- <el-button
- type="primary"
- @click="
- changeParent({ id: supplierId });
- supplierListShow = false;
- "
- >确认</el-button
- >
- <el-button @click="supplierListShow = false">返回</el-button>
- </div>
- </ele-modal>
- </ele-modal>
- </template>
- <script>
- import { emailReg, telReg } from 'ele-admin';
- import inventoryTable from './inventoryTableNew.vue';
- import planTableList from './planTableList.vue';
- import fileUpload from '@/components/upload/fileUpload';
- import dictMixins from '@/mixins/dictMixins';
- import deptSelect from '@/components/CommomSelect/dept-select.vue';
- import personSelect from '@/components/CommomSelect/person-select.vue';
- import parentList from '@/views/purchasingManage/supplierManage/components/parentList.vue';
- import {
- enterprisePage,
- getDetail,
- updateContractStatus
- } from '@/api/contractManage/contractBook';
- import supplierGoodsListDialog from '@/views/purchasingManage/purchaseOrder/components/supplierGoodsListDialog.vue';
- import {
- addInformation,
- getProductsBySource,
- getPurchaseinquiryAPI,
- getpurchaseorderDetail,
- getPurchasePlanByContractIdAPI,
- UpdateInformation,
- getSupplierInfo
- } from '@/api/purchasingManage/purchaseOrder';
- import { getplanDetail } from '@/api/purchasingManage/purchasePlanManage';
- import { getpurchaseinquiry } from '@/api/purchasingManage/inquiryManage';
- import { getcontactlink } from '@/api/saleManage/businessFollow';
- import headList from '@/BIZComponents/user-select/user-select.vue';
- import contractListDialog from '@/views/saleManage/saleOrder/components/contractListDialog.vue';
- import { listOrganizations } from '@/api/system/organization';
- import { copyObj } from '@/utils/util';
- import inquiryManageList from '@/views/purchasingManage/inquiryManage/components/inquiryManage-list.vue';
- // import fileMain from '@/components/addDoc/index.vue';
- import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
- import purchaseNeedList from '@/views/purchasingManage/purchasePlanManage/components/purchaseNeed-list.vue';
- import inquiryList from './inquiryList.vue';
- import projectListDialog from '@/views/saleManage/saleOrder/components/projectListDialog.vue'
- import {
- contactDetail,
- updateRelationStatus
- } from '@/api/saleManage/contact';
- import {
- requirementSourceType,
- acceptUnpackoptions,
- orderSourceType,
- outsourceSceneList
- } from '@/enum/dict.js';
- import returnOrderDialog from '@/views/saleManage/saleOrder/customerReturnOrder/returnOrderDialog.vue';
- import {
- getSaleOrderDetail,
- } from '@/api/saleManage/saleorder';
- import returnOrderDealDialog from './returnOrderDealDialog.vue';
- import purchaseReturnOrderDialog from '@/views/transportManager/shipManage/dispatchManage/components/purchaseReturnOrderDialog.vue';
- import PaymentCollectionPlan from '@/BIZComponents/paymentCollectionPlan/Index.vue'
- import { shippingModePurchaseOp, transactionMethodsOp } from '@/enum/dict.js';
- import { formatDate } from '@/utils/dateUtils';
- import { formatPrice } from '@/BIZComponents/setProduct.js';
- import { parameterGetByCode } from '@/api/main/index.js';
- export default {
- mixins: [dictMixins],
- props: {
- isRequired: {
- type: Boolean,
- default: true
- }
- },
- components: {
- inquiryList,
- purchaseNeedList,
- processSubmitDialog,
- // fileMain,
- inquiryManageList,
- fileUpload,
- headList,
- contractListDialog,
- inventoryTable,
- deptSelect,
- parentList,
- personSelect,
- supplierGoodsListDialog,
- planTableList,
- projectListDialog,
- returnOrderDialog,
- returnOrderDealDialog,
- purchaseReturnOrderDialog,
- PaymentCollectionPlan
- },
- data() {
- let formDef = {
- id: '',
- contractId: '',
- relationType: '',
- relationName: '',
- orderFiles: [],
- contractName: '',
- deliveryDate: '',
- payAmount: '',
- projectName: '',
- projectId: '',
- receiveAddress: '',
- sourceType: '',
- sourceTypeName: '',
- pricingWay: 1,
- remark: '',
- saleType: '',
- saleTypeName: '',
- totalAmount: '',
- settlementMode: '4',
- settlementModeName: '分期付款',
- partaUnifiedSocialCreditCode: '',
- partbUnifiedSocialCreditCode: '',
- partaAddress: '',
- partaEmail: '',
- partaFax: '',
- partaId: '',
- partaLinkId: '',
- partaLinkName: '',
- partaName: '',
- partaTel: '',
- partbAddress: '',
- partbEmail: '',
- partbFax: '',
- partbId: '',
- partbLinkId: '',
- partbLinkName: '',
- partbName: '',
- partbTel: '',
- purchasePlanId: '',
- purchasePlanNo: '',
- purchasePlanName: '',
- isFirstProcess: 0,
- purchaseDeptId: '',
- purchaseDeptName: '',
- purchaseUserId: '',
- purchaseUserName: '',
- issueNumber: 1,
- transactionMode: 1,
- deliveryMode: 1,
- settlementDate: [],
- endSettlementDate: '',
- startSettlementDate: '',
- receiptDate: 1,
- contractStartDate:''
- };
- return {
- purchaseReturnOrderDialogFlag: false,
- returnOrderDealDialogFlag: false,
- returnOrderDialogFlag: false,
- supplierListShow: false,
- supplierList: [],
- supplierId: '',
- orderSourceType,
- outsourceSceneList,
- requirementSourceType,
- processList: [
- {
- label: '是',
- value: 1
- },
- {
- label: '否',
- value: 0
- }
- ],
- isFlag: false, //订单类型是否不可修改
- clearing: false, //是否清除合同
- payWayOptions: [],
- delDetailIds: [],
- linkNameOptions: [],
- acceptUnpackoptions,
- visible: false,
- fullscreen: false,
- processSubmitDialogFlag: false,
- supplierGoodsListDialogFlag: false,
- title: '',
- row: {},
- activeName: '1',
- pricingWayList: [
- { id: 1, name: '按数量计价' },
- { id: 2, name: '按重量计价' }
- ],
- formDef,
- form: copyObj(formDef),
- enterprisePage: [],
- tableBankData: [],
- tableLinkData: [],
- // 组织机构树形结构数据
- groupTreeData: [],
- groupData: [],
- OutValidate: ['3', '4'],
- // 提交状态
- loading: false,
- // 是否是修改
- isUpdate: false,
- businessId: '',
- winnerSuppleIds: '',
- shippingModePurchaseOp,
- transactionMethodsOp,
- defaultTransactionMode: 1,
- isBatchNo: 0
- };
- },
- computed: {
- allcountAmount() {
- return this.$store.state.order.allcountAmount;
- },
- showReturnRelation() {
- return ['8','9'].includes(this.form.sourceType);
- },
- filterList() {
- return this.isUpdate ? this.requirementSourceType : this.requirementSourceType.filter(item => item.value !== '8');
- },
- rules() {
- let isRequired = this.isRequired;
- // console.log(this.isRequired);
- return {
- deliveryDate: [
- { required: true, message: '请选择交货日期', trigger: 'change' }
- ],
- purchasePlanName: [
- {
- required: this.OutValidate.includes(this.form.sourceType),
- message: '请选择采购计划单',
- trigger: ['change', 'blur']
- }
- ],
- relationName: [
- {
- required: true,
- message: '请选择',
- trigger: ['change', 'blur']
- }
- ],
- contractName: [
- {
- required: true,
- message: '请选择合同',
- trigger: ['change', 'blur']
- }
- ],
- // purchaseType: [
- // {required: true, message: '请选择采购订单类型', trigger: 'change'}
- // ],
- settlementMode: [
- { required: true, message: '请选择结算方式', trigger: 'change' }
- ],
- partaName: [
- {
- required: true,
- message: '请选择供应商名称',
- trigger: 'change'
- }
- ],
- partaLinkName: [
- {
- required: isRequired,
- message: '请选择供应商联系人',
- trigger: 'change'
- }
- ],
- acceptUnpack: [
- { required: true, message: '请选择是否接受', trigger: 'change' }
- ],
- sourceType: [
- { required: true, message: '请选择订单类型', trigger: 'change' }
- ],
- payAmount: [{ required: true, message: '请输入', trigger: 'blur' }],
- // partbAddress: [
- // { required: true, message: '请输入', trigger: 'blur' }
- // ],
- partaTel: [
- {
- required: isRequired,
- pattern: isRequired ? telReg : null,
- message: '请输入供应商联系电话',
- trigger: 'blur'
- }
- ],
- partbName: [
- { required: true, message: '请输入供采购方名称', trigger: 'change' }
- ],
- partbLinkName: [
- {
- required: isRequired,
- message: '请输入供采购方联系人',
- trigger: 'change'
- }
- ],
- partbTel: [
- {
- required: isRequired,
- pattern: isRequired ? telReg : null,
- message: '请输入供采购方联系电话',
- trigger: 'blur'
- }
- ],
- partaEmail: [
- { pattern: emailReg, message: '邮箱格式不正确', trigger: 'blur' }
- ]
- };
- }
- },
- created() {
- console.log(this);
- this.getGroupAll();
- this.getEnterprisePage();
- this.changePersonel();
- //交易方式//1 先票后款 2 先款后票
- parameterGetByCode({
- code: 'eom_contract_add_transactionMode'
- }).then((res) => {
- this.defaultTransactionMode = +res.value;
- });
- //批次号是否必填//0否 1是
- parameterGetByCode({
- code: 'eom_purchaseOrder_batchNo'
- }).then((res) => {
- this.isBatchNo = res.value;
- });
- },
- methods: {
- setIssueNumber(len) {
- this.form.issueNumber = len;
- },
- getSupplierData(data) {
- console.log('data~~~', data);
- if(!this.form.partbName) {
- getSupplierInfo(data[data.length - 1].productId).then((res) => {
- console.log('res~~~', res);
- this.changeParent(res.data);
- })
- }
- },
- //选择退货单
- handleReturnBtn(e) {
- // this.$refs.returnListRef.open();
- if (e.target.nodeName == 'I') {
- this.$set(this.form, 'relationCode', '');
- this.$set(this.form, 'relationId', '');
- return;
- }
- this.returnOrderDialogFlag = true;
- },
- //退货单
- async changeReturn(row) {
- // console.log('data~~~', row);
- // this.form = Object.assign({}, this.form, {
- // relationCode: row.returnNo,
- // relationId: row.id
- // });
- // this.$set(this.form, 'relationName', data.requirementName);
- this.$set(this.form, 'relationId', row.id);
- this.$set(this.form, 'relationName', row.returnNo);
- this.getReturnOrderDetail(row);
- },
- async getReturnOrderDetail(row) {
- console.log('row', row.orderNo);
- const id = row.orderIds.split(',')[0];
- const res = await getSaleOrderDetail(id);
- console.log('res~~~~', res);
- if (row.partaId) {
- await this.changeParent({ id: row.partaId }, true);
- }
- if (res) {
- let {
- // partaAddress,
- // partaEmail,
- // partaFax,
- // partaId,
- // partaLinkId,
- // partaLinkName,
- // partaName,
- // partaTel,
- partbAddress,
- partbEmail,
- partbFax,
- partbId,
- partbLinkId,
- partbLinkName,
- partbName,
- partbTel,
- totalPrice,
- discountTotalPrice,
- // partaUnifiedSocialCreditCode,
- partbUnifiedSocialCreditCode,
- settlementMode,
- settlementModeName,
- pricingWay,
- productList,
- typedetailList,
- totalAmount,
- payAmount
- } = res;
- this.form = Object.assign({}, this.form, {
- partaAddress: partbAddress,
- partaEmail: partbEmail,
- partaFax: partbFax,
- partaId: partbId,
- partaLinkId: partbLinkId,
- partaLinkName: partbLinkName,
- partaName: partbName,
- partaTel: partbTel,
- // partbAddress,
- // partbEmail,
- // partbFax,
- // partbId,
- // partbLinkId,
- // partbLinkName,
- // partbName,
- // partbTel,
- totalPrice,
- discountTotalPrice,
- partaUnifiedSocialCreditCode: partbUnifiedSocialCreditCode,
- settlementMode,
- settlementModeName,
- pricingWay,
- productList,
- typedetailList,
- // totalAmount,
- payAmount
- });
- this.$nextTick(() => {
- this.$store.commit('order/setAllcountAmount', totalAmount);
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.putTableValue(res.productList);
- this.getLinkInfo(row.partaId);
- });
- }
- },
- // 销售处理退货
- handleReturnDealBtn(e) {
- if (e.target.nodeName == 'I') {
- this.$set(this.form, 'relationCode', '');
- this.$set(this.form, 'relationId', '');
- return;
- }
- this.returnOrderDealDialogFlag = true;
- },
- async changeReturnDeal(row) {
- this.$set(this.form, 'relationId', row.id);
- this.$set(this.form, 'relationName', row.returnNo);
- this.getReturnOrderDetail(row);
- },
- //选择采购退货单
- handlePurchaseReturnOrder() {
- this.purchaseReturnOrderDialogFlag = true;
- },
- //采购退货单回调
- getPReturnOrderInfo(row) {
- console.log('params~~~~', row);
- this.$set(this.form, 'relationId', row.id);
- this.$set(this.form, 'relationName', row.returnNo);
- this.getReturnPurchaseDetail(row);
- },
- async getReturnPurchaseDetail(row) {
- this.businessId = row.orderId;
- this.loading = true;
- const data = await getpurchaseorderDetail(row.orderId);
- this.loading = false;
- // this.form = data;
-
- if (data) {
- let {
- partaAddress,
- partaEmail,
- partaFax,
- partaId,
- partaLinkId,
- partaLinkName,
- partaName,
- partaTel,
- partbAddress,
- partbEmail,
- partbFax,
- partbId,
- partbLinkId,
- partbLinkName,
- partbName,
- partbTel,
- totalPrice,
- discountTotalPrice,
- partaUnifiedSocialCreditCode,
- partbUnifiedSocialCreditCode,
- settlementMode,
- settlementModeName,
- pricingWay,
- productList,
- typedetailList,
- totalAmount,
- payAmount
- } = data;
- this.form = Object.assign({}, this.form, {
- partaAddress,
- partaEmail,
- partaFax,
- partaId,
- partaLinkId,
- partaLinkName,
- partaName,
- partaTel,
- partbAddress,
- partbEmail,
- partbFax,
- partbId,
- partbLinkId,
- partbLinkName,
- partbName,
- partbTel,
- totalPrice,
- discountTotalPrice,
- partaUnifiedSocialCreditCode,
- partbUnifiedSocialCreditCode,
- settlementMode,
- settlementModeName,
- pricingWay,
- productList,
- typedetailList,
- totalAmount,
- payAmount
- });
- this.$nextTick(() => {
- this.$store.commit('order/setAllcountAmount', totalAmount);
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.putTableValue(data.productList);
- this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.putTableValue(data.rawList); //原料
- this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.putTableValue(data.outputList); //产成品
- this.getLinkInfo(data.partaId);
- this.getrequireUser(this.form.requireDeptId);
- // this.$store.commit('order/setContractId', data.contractId);
- });
- }
- },
- //选择项目弹框
- handleProjectBtn() {
- if (this.clearing) return;
- let item = {
- id: this.form.projectId
- };
- this.$refs.selectProjectRef.open(item);
- },
- //选择项目回调
- async changeProject(obj) {
- this.projectData = obj;
- this.form = Object.assign({}, this.form, {
- projectName: obj.name,
- // projectId: obj.id,
- // projectCode: obj.code,
- });
- },
- // 选择负责人部门
- change_principalDep(id) {
- const info = this.groupData.find((e) => e.id == id);
- this.form.requireDeptName = info.name;
- // this.form.requireUserId = '';
- // this.form.requireUserName = '';
- this.$set(this.form, 'requireUserId', '');
- this.$set(this.form, 'requireUserName', '');
- // 根据部门获取人员
- this.getrequireUser(id);
- },
- // 选择采购部门
- changePurchaseDep(id) {
- const info = this.groupData.find((e) => e.id == id);
- this.form.purchaseDeptName = info.name;
- this.$set(this.form, 'purchaseUserId', '');
- this.$set(this.form, 'purchaseUserName', '');
- this.getPurchaseUser(id);
- },
- getPurchaseUser(groupId) {
- console.log('groupId~~~~', groupId);
- if (groupId) {
- this.$refs.purchaseDirectorRef.getList({ groupId });
- }
- },
- //选择采购需求
- handPurchaseNeed() {
- this.$refs.purchaseNeedList.open(
- this.form.relationCode,
- this.form.sourceType
- );
- },
- //选择采购需求回调
- async changePurchaseNeedList(data) {
- this.form.relationId = data.id;
- this.form.relationCode = data.requirementCode;
- this.form.relationName = data.requirementName;
- this.$set(this.form, 'relationName', data.requirementName);
- this.$set(this.form, 'relationId', data.id);
- this.$set(this.form, 'relationCode', data.requirementCode);
- this.$set(this.form, 'requireDeptId', data.requireDeptId);
- this.$set(this.form, 'requireDeptName', data.requireDeptName);
- this.$set(this.form, 'requireUserId', data.requireUserId);
- this.$set(this.form, 'requireUserName', data.requireUserName);
- this.getrequireUser(data.requireDeptId);
- let info = await getProductsBySource({
- relationId: this.form.relationId,
- relationType: this.form.relationType
- });
- info.productList.forEach((item) => {
- item['deliveryDeadline'] = item.expectReceiveDate;
- });
- let form = {
- contractVO: {
- ...this.form
- },
- productList: info.productList || []
- };
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.putTableValue(form.productList);
- },
- //选择采购计划
- handPurchasePlan() {
- this.$refs.inquiryManageRef.open(
- this.form.planCode,
- this.form.sourceType
- );
- },
- //选择采购计划回调
- async changeInquiryManageList(data) {
- this.form.purchasePlanId = data.id;
- this.form.purchasePlanNo = data.planCode;
- this.form.purchasePlanName = data.planName;
- this.form.relationId = data.id;
- this.form.relationCode = data.planCode;
- this.form.relationName = data.planName;
- this.form.requireDeptId = data.requireDeptId;
- this.form.requireDeptName = data.requireDeptName;
- this.form.requireUserId = data.requireUserId;
- this.form.requireUserName = data.requireUserName;
- this.$set(this.form, 'requireDeptId', data.requireDeptId);
- this.$set(this.form, 'requireDeptName', data.requireDeptName);
- this.$set(this.form, 'requireUserId', data.requireUserId);
- this.$set(this.form, 'requireUserName', data.requireUserName);
- this.getrequireUser(data.requireDeptId);
- // let cusInfo = {}
- this.$set(this.form, 'purchasePlanName', data.planName);
- this.$set(this.form, 'purchasePlanId', data.id);
- this.$set(this.form, 'purchasePlanNo', data.planCode);
- this.$set(this.form, 'relationName', data.planName);
- this.$set(this.form, 'relationId', data.id);
- this.$set(this.form, 'relationCode', data.planCode);
- const res = await getplanDetail(data.id);
- this.$set(this.form, 'isFirstProcess', res.isFirstProcess);
- let info = await getProductsBySource({
- relationId: this.form.relationId,
- relationType: this.form.relationType
- });
- info['rawDetailList'] = info.rawList;
- info['outputDetailList'] = info.outputList;
- info.productList.forEach((item) => {
- item['deliveryDeadline'] = item.expectReceiveDate;
- });
- let supplierList = res.detailList
- .filter((item) => item.supplierId)
- .map((item) => {
- return {
- supplierId: item.supplierId,
- supplierName: item.supplierName
- };
- });
- if (supplierList?.length > 0) {
- this.supplierList = Array.from(
- new Set(supplierList.map((obj) => JSON.stringify(obj)))
- ).map((str) => JSON.parse(str));
- this.$nextTick(() => {
- this.putTableValue(info);
- });
- if (
- this.supplierList.length == 1 &&
- this.supplierList[0]?.supplierId
- ) {
- await this.changeParent({ id: this.supplierList[0]?.supplierId });
- } else {
- this.supplierListShow = true;
- }
- } else {
- this.putTableValue(info);
- }
- // let form = {
- // contractVO: {
- // ...this.form
- // },
- // productList: info.productList || []
- // }
- // const codeList = form.productList.map((item) => item.productCode);
- // let inventoryTotalList = await getInventoryTotalAPI(codeList);
- // form.productList.forEach((item) => {
- // let find =
- // inventoryTotalList.find((key) => key.code == item.productCode) || {};
- // item.availableCountBase = find.availableCountBase;
- // });
- // this.$refs.inventoryTable &&
- // this.$refs.inventoryTable.putTableValue(form.productList);
- },
- //选择核价单
- handInquiry(e) {
- this.$refs.inquiryListRef.open(this.form.sourceType);
- },
- //选择采购核价回调
- async changeInquiryList(data) {
- console.log(data, '=======');
- this.form.relationId = data.id;
- this.form.relationCode = data.inquiryCode;
- this.form.relationName = data.inquiryName;
- this.winnerSuppleIds = data.winnerSuppleIds;
- this.$set(this.form, 'relationName', data.inquiryName);
- this.$set(this.form, 'relationId', data.id);
- this.$set(this.form, 'relationCode', data.inquiryCode);
- const res = await getpurchaseinquiry(data.id);
- this.$set(this.form, 'isFirstProcess', res.isFirstProcess);
- this.$set(this.form, 'requireDeptId', res.requireDeptId);
- this.$set(this.form, 'requireDeptName', res.requireDeptName);
- this.$set(this.form, 'requireUserId', res.requireUserId);
- this.$set(this.form, 'requireUserName', res.requireUserName);
- this.getrequireUser(res.requireDeptId);
- let info = await getProductsBySource({
- relationId: this.form.relationId,
- relationType: this.form.relationType,
- supplierId: this.winnerSuppleIds
- });
- info['rawDetailList'] = info.rawList;
- info['outputDetailList'] = info.outputList;
- info.productList.forEach((item) => {
- item['discountSinglePrice'] = item.singlePrice;
- item['discountTotalPrice'] = item.totalPrice;
- });
- if (info.productList.length > 1) {
- this.$refs.planTableListRef.open(info);
- } else {
- this.$nextTick(() => {
- this.putTableValue(info);
- });
- }
- this.form = {
- ...this.form,
- partbId: info.partbId,
- partbName: info.partbName,
- partbAddress: info.partaAddress,
- partbLinkId: info.partaAddress,
- partbLinkName: info.partbLinkName,
- partbEmail: info.partbEmail,
- partbTel: info.partbTel
- };
- await this.getLinkInfo(info.partbId);
- this.$nextTick(() => {
- let firstLink =
- this.linkNameOptions.find((item) => item.ifChief == 1) || {};
- this.form = Object.assign({}, this.form, {
- partbLinkId: firstLink.id || this.linkNameOptions[0]?.id,
- partbLinkName:
- firstLink.linkName || this.linkNameOptions[0]?.linkName,
- partbTel:
- firstLink.mobilePhone || this.linkNameOptions[0]?.mobilePhone
- });
- this.setProductInfo();
- });
- await this.changeParent({ id: info.partbId });
- },
- async putTableValue({ productList, rawDetailList, outputDetailList }) {
- let totalPrice = 0;
- productList.forEach((item) => {
- totalPrice += item.totalPrice;
- });
- this.$store.commit('order/setAllcountAmount', totalPrice);
- this.$set(this.form, 'totalPrice', totalPrice);
- if (this.form.relationType == 3) {
- this.$set(this.form, 'payAmount', totalPrice);
- }
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.putTableValue(productList);
- this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.putTableValue(rawDetailList); //原料
- this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.putTableValue(outputDetailList);
- },
- getrequireUser(groupId) {
- if (groupId) {
- this.$refs.directorRef.getList({ groupId });
- }
- },
- salesmanChange(val, info) {
- this.$set(this.form, 'requireUserId', val);
- this.$set(this.form, 'requireUserName', info.name);
- // this.form.requireUserName = info.name;
- },
- purchaseUserChange(val, info) {
- this.$set(this.form, 'purchaseUserId', val);
- this.$set(this.form, 'purchaseUserName', info.name);
- },
- // 获取公司数据
- getGroupAll() {
- listOrganizations().then((list) => {
- this.groupData = list;
- this.groupTreeData = this.$util.toTreeData({
- data: list,
- idField: 'id',
- parentIdField: 'parentId'
- });
- });
- },
- discountInput() {
- this.$refs.inventoryTable.discountInputByOrder(this.form.payAmount);
- this.$refs.paymentCollectionPlanRef?.setDiscountAmount(this.form.payAmount);
- },
- //产品清单修改单价或者数量重置优惠金额
- orderDiscountAmount(val = 0) {
- console.log('orderDiscountAmount~~~~', val);
- this.form.payAmount = val;
- this.$refs.paymentCollectionPlanRef.setDiscountAmount(val);
- //this.form.payAmount = undefined
- },
- //选择合同获取合同的详情
- async getDetailData(id) {
- this.loading = true;
- const data = await getDetail(id);
- let info = await getProductsBySource({
- relationId: this.form.relationId,
- relationType: this.form.relationType
- });
- this.loading = false;
- if (data) {
- // if (data.contractVO.sourceType == 3 && data.contractVO.sourceId) {
- // //获取需求部门
- // const res = await getplanDetail(data.contractVO.sourceId);
- // this.$nextTick(() => {
- // this.form.requireDeptId = res.requireDeptId;
- // this.form.requireDeptName = res.requireDeptName;
- // this.form.requireUserId = res.requireUserId;
- // this.form.requireUserName = res.requireUserName;
- // });
- // }
- this.$set(this.form, 'requireDeptId', data.contractVO?.requireDeptId);
- this.$set(
- this.form,
- 'requireDeptName',
- data.contractVO?.requireDeptName
- );
- this.$set(this.form, 'requireUserId', data.contractVO?.requireUserId);
- // this.$set(this.form, 'businessDeptId', data.contractVO?.businessDeptId);
- // this.$set(this.form, 'businessDeptName', data.contractVO?.businessDeptName);
- // this.$set(this.form, 'businessUserId', data.contractVO?.businessUserId);
- // this.$set(this.form, 'businessUserName', data.contractVO?.businessUserName);
- this.$set(
- this.form,
- 'requireUserName',
- data.contractVO?.requireUserName
- );
- console.log('data.contractVO~~~~', data.contractVO);
- this.getrequireUser(data.contractVO?.requireDeptId);
- this.getPurchaseUser(data.contractVO?.businessDeptId);
- this.$nextTick(() => {
- let { contractVO } = data;
- // this.form=contractVOform.receiveAddress
- let {
- partaAddress,
- partaEmail,
- partaFax,
- partaId,
- partaLinkId,
- partaLinkName,
- partaName,
- partaTel,
- partbAddress,
- partbEmail,
- partbFax,
- partbId,
- partbLinkId,
- partbLinkName,
- partbName,
- partbTel,
- totalPrice,
- discountTotalPrice,
- partaUnifiedSocialCreditCode,
- partbUnifiedSocialCreditCode,
- settlementMode,
- settlementModeName,
- pricingWay,
- isFirstProcess,
- requireSourceType,
- requireSourceTypeName,
- businessDeptId,
- businessDeptName,
- businessUserId,
- businessUserName,
- transactionMode,
- startSettlementDate,
- receiptDate,
- issueNumber,
- endSettlementDate,
- deliveryMode,
- } = contractVO;
- this.form = Object.assign({}, this.form, {
- partaAddress,
- partaEmail,
- partaFax,
- partaId,
- partaLinkId,
- partaLinkName,
- partaName,
- partaTel,
- partbAddress,
- partbEmail,
- partbFax,
- partbId,
- partbLinkId,
- partbLinkName,
- partbName,
- partbTel,
- totalPrice,
- settlementMode,
- settlementModeName,
- discountTotalPrice,
- partaUnifiedSocialCreditCode,
- partbUnifiedSocialCreditCode,
- pricingWay,
- totalAmount: totalPrice,
- payAmount: discountTotalPrice,
- receiveAddress: partaAddress,
- isFirstProcess,
- sourceType: requireSourceType || '1',
- sourceTypeName: requireSourceTypeName,
- purchaseDeptId: businessDeptId,
- purchaseDeptName: businessDeptName,
- purchaseUserId: businessUserId,
- purchaseUserName: businessUserName,
- transactionMode,
- startSettlementDate,
- receiptDate,
- issueNumber,
- endSettlementDate,
- deliveryMode,
- settlementDate: startSettlementDate ? [startSettlementDate, endSettlementDate] : [],
- });
- this.getLinkInfo(partaId);
- // info.productList = info.productList.map((item) => {
- // item['purchaseCount'] = item.contractCount;
- // item['purchaseUnit'] = item.contractUnit;
- // item['purchaseUnitId'] = item.contractUnitId;
- // return item;
- // });
- if (info.productList.length > 1) {
- console.log('info.productList~~~~', info.productList);
- this.$refs.planTableListRef.contractOpen(
- info.productList,
- contractVO.contractStartDate
- );
- } else {
- this.contractSuccess({
- productList: info.productList,
- contractStartDate: contractVO.contractStartDate
- });
- }
- const receiptData = {
- receiptPaymentList: data.receiptPaymentList,
- payAmount: discountTotalPrice
- }
- this.$refs.paymentCollectionPlanRef &&
- this.$refs.paymentCollectionPlanRef.putTableValue(receiptData);
- this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.putTableValue(contractVO.rawList); //原料
- this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.putTableValue(
- contractVO.outputList
- );
- this.$store.commit('order/setAllcountAmount', totalPrice);
- });
- }
- },
- contractSuccess({ productList, contractStartDate }) {
- console.log('productList~~~contractSuccess', productList);
- this.$nextTick(() => {
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.putTableValue(
- productList,
- contractStartDate
- );
- });
- },
- //获取订单详情
- async getpurchaseorderDetail(id) {
- this.businessId = id;
- this.loading = true;
- const data = await getpurchaseorderDetail(id);
- this.loading = false;
- data.settlementDate = data.startSettlementDate ? [data.startSettlementDate, data.endSettlementDate] : [];
- this.form = data;
- console.log('data~~~~~~~000', data);
- if (data) {
- this.$nextTick(() => {
- this.$store.commit('order/setAllcountAmount', data.totalAmount);
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.putTableValue(data.productList);
- this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.putTableValue(data.rawList); //原料
- this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.putTableValue(data.outputList); //产成品
- this.getLinkInfo(data.partaId);
-
- this.$refs.paymentCollectionPlanRef && this.$refs.paymentCollectionPlanRef.putTableValue(data);
- this.getrequireUser(this.form.requireDeptId);
- if(data.purchaseDeptId) {
- this.getPurchaseUser(data.purchaseDeptId);
- }
- this.$store.commit('order/setContractId', data.contractId);
- });
- }
- },
- //更新联系人数据
- async getLinkInfo(contactId) {
- const data = await getcontactlink({ contactId });
- if (data && data?.length) {
- this.linkNameOptions = data;
- }
- },
- sourceTypeChange() {
- // 当sourceType改变时,重置relationType及相关字段
- this.form.relationType = '';
- this.valueChange();
- },
- handleChangeRelationType(val) {
- // if(this.showReturnRelation) {
- // this.form.relationType = val;
- // }
- this.valueChange();
- },
- valueChange() {
- this.form.purchasePlanId = '';
- this.form.purchasePlanNo = '';
- this.form.purchasePlanName = '';
- this.form.relationId = '';
- this.form.relationCode = '';
- this.form.relationName = '';
- this.$nextTick(() => {
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.putTableValue([]);
- });
- },
- //选择下拉框
- onchangeLink(selectedOptions) {
- const option = this.linkNameOptions.find(
- (opt) => opt.id === selectedOptions
- );
- this.form = Object.assign({}, this.form, {
- partbEmail: option?.email,
- partbLinkName: option?.linkName || '',
- partbTel: option?.mobilePhone || option?.phone || '',
- partbLinkId: option?.id
- });
- },
- handHead() {
- let item = {
- id: this.form.partaLinkId
- };
- this.$refs.headRef.open(item);
- },
- //选择供采购方人回调
- changePersonel(obj) {
- if (!obj) {
- obj = this.$store.getters.user.info;
- obj.id = obj.userId;
- }
- this.$set(this.form, 'partaLinkId', obj.id);
- this.$set(this.form, 'partaLinkName', obj.name);
- this.$set(this.form, 'partaTel', obj.phone);
- this.$set(this.form, 'partaEmail', obj.email);
- },
- //选择供应商回调
- async changeParent(obj) {
- if (!obj.id) {
- return;
- }
- const { base, other } = await contactDetail(obj.id);
- this.form = Object.assign({}, this.form, {
- partbId: base.id,
- partbName: base.name,
- partbAddress: other.addressName
- ? other.addressName + other.address
- : base.addressName + other.address,
- partbLinkId: '',
- partbLinkName: '',
- partbEmail: '',
- partbTel: '',
- supplierMark: base.serialNo,
- partbUnifiedSocialCreditCode: base.unifiedSocialCreditCode
- });
- await this.getLinkInfo(obj.id);
- // this.form.productList=productList
- this.$nextTick(() => {
- let firstLink =
- this.linkNameOptions.find((item) => item.ifChief == 1) || {};
- this.form = Object.assign({}, this.form, {
- partbLinkId: firstLink.id || this.linkNameOptions[0]?.id,
- partbLinkName:
- firstLink.linkName || this.linkNameOptions[0]?.linkName,
- partbTel:
- firstLink.mobilePhone || this.linkNameOptions[0]?.mobilePhone
- });
- this.setProductInfo();
- });
- },
- setProductInfo() {
- this.$refs.inventoryTable.setCustomerMark(this.form.supplierMark);
- },
- //选择合同回调
- async changeContract(obj) {
- this.form = Object.assign({}, this.form, {
- contractId: obj.id,
- contractName: obj.contractName,
- contractNo: obj.contractNo,
- relationId: obj.id,
- relationName: obj.contractName,
- relationCode: obj.contractNo,
- contractStartDate: obj.contractStartDate,
- });
- await this.getPlanInfo(this.form.contractId);
- await this.getDetailData(obj.id);
- // //采购询价表
- // if(obj.sourceType==2){
- // obj.sourceId && this.getPurchaseinquiry(obj.sourceId);
- // }
- // //采购计划
- // if(obj.sourceType==3){
- // obj.sourceId && this.getPlanInfo(this.form.contractId);
- // }
- this.$store.commit('order/setContractId', obj.id);
- //获取合同采购计划
- },
- async getPlanInfo(id) {
- let res = await getPurchasePlanByContractIdAPI(id);
- if (!res.data?.id) return;
- this.form = Object.assign({}, this.form, {
- purchasePlanId: res.data?.id,
- purchasePlanName: res.data?.planName,
- purchasePlanNo: res.data?.planCode,
- sourceType: res.data?.sourceType,
- sourceTypeName: res.data?.sourceTypeName
- });
- },
- //选择合同弹框
- handleContractBtn() {
- if (this.clearing) return;
- let item = {
- id: this.form.contractId
- };
- this.$refs.selectContractRef.open(item, this.form.sourceType);
- },
- //清除合同
- clearContrcat() {
- this.clearing = true;
- this.isFlag = false;
- let {
- sourceType,
- sourceTypeName,
- requireDeptId,
- requireDeptName,
- requireUserId,
- requireUserName,
- settlementMode,
- settlementModeName,
- id,
- projectName,
- saleType,
- saleTypeName,
- deliveryDate,
- orderFiles,
- remark
- } = this.form;
- this.form = Object.assign({}, copyObj(this.formDef), {
- id,
- projectName,
- saleType,
- saleTypeName,
- deliveryDate,
- orderFiles,
- remark,
- sourceType,
- sourceTypeName,
- requireDeptId,
- requireDeptName,
- requireUserId,
- requireUserName,
- settlementMode,
- settlementModeName
- });
- this.$store.commit('order/setContractId', '');
- this.$store.commit('order/setAllcountAmount', 0);
- this.$refs.inventoryTable.putTableValue([]);
- this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.putTableValue([]);
- this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.putTableValue([]);
- setTimeout(() => {
- this.clearing = false;
- }, 500);
- },
- handParent() {
- if (this.form.contractId) {
- return this.$message.error('选择了合同不能更改供应商名称');
- }
- let item = {
- id: this.form.contactId
- };
- this.$refs.parentRef.open(item);
- },
- //通过合同获取订单类型
- async getPurchaseinquiry(sourceId) {
- let data = await getPurchaseinquiryAPI(sourceId);
- this.isFlag = !!data.sourceType;
- this.form = Object.assign({}, this.form, {
- sourceType: data.sourceType,
- sourceTypeName: data.sourceTypeName
- });
- },
- //打开新增编辑弹框
- async open(type, row, contactCategoryId) {
- this.title = type === 'add' ? '新增' : '修改';
- this.activeName = '1';
- this.row = row;
- this.visible = true;
- if (this.enterprisePage.length == 0) {
- await this.getEnterprisePage();
- }
- if (type == 'add') {
- // console.log('enterprisePage~~~~~', this.enterprisePage);
- this.form.transactionMode = this.defaultTransactionMode;
- this.isUpdate = false;
- if (this.enterprisePage.length > 0) {
- this.form.partaName = this.enterprisePage[0]?.name;
- this.form.partaUnifiedSocialCreditCode =
- this.enterprisePage[0]?.unifiedSocialCreditCode;
- this.form.partaFax = this.enterprisePage[0]?.fax;
- this.form.partaAddress = this.enterprisePage[0]?.address;
- this.form.purchaseDeptId = this.enterprisePage[0]?.groupId || '';
- this.form.purchaseDeptName = this.enterprisePage[0]?.name || '';
- this.form.purchaseUserId = this.$store.state.user.info?.id || '';
- this.form.purchaseUserName = this.$store.state.user.info?.name || '';
- this.$nextTick(() => {
- this.issueNumberChange(this.form.issueNumber);
- if(this.form.purchaseDeptId) {
- this.getPurchaseUser(this.form.purchaseDeptId);
- }
- })
- }
- this.form.contractStartDate = formatDate(new Date(), 'yyyy-MM-dd');
- } else {
- this.isUpdate = true;
- await this.getpurchaseorderDetail(row.id);
- }
- },
- getEnterprisePage() {
- enterprisePage({
- pageNum: 1,
- size: 100
- }).then((res) => {
- this.enterprisePage = [];
- this.enterprisePage.push(...res.list);
- });
- },
- getEnterprise() {
- let data = this.enterprisePage.find(
- (item) => item.name == this.form.quoteName
- );
- this.form.partaName = data.name;
- this.form.partaUnifiedSocialCreditCode = data.unifiedSocialCreditCode;
- this.form.partaFax = data.fax;
- this.form.partaAddress = data.address;
- },
- //从合同页面新增订单
- contractOpen(row) {
- this.title = '新增';
- this.visible = true;
- this.isUpdate = false;
- this.form.relationType = 4;
- this.changeContract(row);
- },
- handleGoodsList() {
- console.log(11111);
- this.supplierGoodsListDialogFlag = true;
- this.$nextTick(() => {
- this.$refs.supplierGoodsListDialogRef.open(this.form.partbId);
- });
- },
- changeValue(val = []) {
- this.$refs.inventoryTable &&
- this.$refs.inventoryTable.getGoodsListData(val);
- },
- // 交易方式改变
- transactionModeChange(v) {
- },
- // 配送方式改变
- deliveryModeChange(v) {
- },
- // 结算方式改变
- settlementModeChange(v) {
- console.log('v~~~', v.dictCode);
- this.form.settlementModeName = v.dictValue;
- // this.$set(this.form, 'issueNumber', 1);
- this.$set(this.form, 'settlementDate', []);
- this.$set(this.form, 'receiptDate', 1);
-
- if(v.dictCode == 3) {
- this.$set(this.form, 'issueNumber', 2);
- } else {
- this.$set(this.form, 'issueNumber', 1);
- }
- this.$refs.paymentCollectionPlanRef.defaultList(v.dictCode, this.form.issueNumber);
- },
- // settlementModeChange(info) {
- // this.form.settlementModeName = info.dictValue;
- // },
- ifChiefChange(value, idx) {
- if (value === 1) {
- this.tableLinkData.forEach((e) => (e.ifChief = 0));
- this.tableLinkData[idx].ifChief = 1;
- }
- },
- getValidate() {
- return Promise.all([
- new Promise((resolve, reject) => {
- this.$refs.form.validate((valid) => {
- if (!valid) {
- reject(false);
- } else {
- resolve(true);
- }
- });
- }),
- new Promise((resolve, reject) => {
- this.$refs.inventoryTable.validateForm((valid) => {
- if (!valid) {
- reject(false);
- } else {
- resolve(true);
- }
- });
- }),
- new Promise((resolve, reject) => {
- this.$refs.paymentCollectionPlanRef.validateForm((valid) => {
- if (!valid) {
- reject(false);
- } else {
- resolve(true);
- }
- });
- })
- ]);
- },
- async save(type) {
- let is = false;
- try {
- await this.getValidate();
- // 表单验证通过,执行保存操作
- this.loading = true;
- let isTemporary = [];
- if (!this.isUpdate) {
- delete this.form.id;
- }
- // if (!this.form.contractId) { //如果来源是合同 金额不变这个逻辑有问题 先注释
- // this.form.totalAmount = this.allcountAmount;
- // }
- const rawDetailList =
- (this.$refs.rawDetailListRef &&
- this.$refs.rawDetailListRef.getTableValue()) ||
- [];
- const outputDetailList =
- (this.$refs.outputDetailListRef &&
- this.$refs.outputDetailListRef.getTableValue()) ||
- [];
- const tabList =
- (this.$refs.inventoryTable &&
- this.$refs.inventoryTable.getTableValue()) ||
- [];
- tabList.forEach((v, i) => {
- if (!v.productCode) {
- isTemporary.push(v.productName);
- }
- // tabList.forEach((v2, j) => {
- // if (
- // v.productCode == v2.productCode &&
- // v.taskId == v2.taskId &&
- // v.batchNo == v2.batchNo &&
- // i != j
- // ) {
- // is = true;
- // }
- // });
- });
- if (isTemporary.length > 0) {
- this.$message.error(
- isTemporary.toString() +
- '是临时产品,无法创建订单,请先去主数据维护!'
- );
- return;
- }
- // if (is) {
- // this.$message.error('同产品,工序、批次号不能完全一致!');
- // return;
- // }
- let productList = [
- ...tabList,
- ...rawDetailList.map((item) => {
- item.singlePrice = item.singlePrice || 0;
- item.discountSinglePrice = item.discountSinglePrice || 0;
- item.totalPrice = item.totalPrice || 0;
- item.discountTotalPrice = item.discountTotalPrice || 0;
- return item;
- }),
- ...outputDetailList.map((item) => {
- item.singlePrice = item.singlePrice || 0;
- item.discountSinglePrice = item.discountSinglePrice || 0;
- item.discountTotalPrice = item.discountTotalPrice || 0;
- item.totalPrice = item.totalPrice || 0;
- return item;
- })
- ];
- let commitData = Object.assign({}, this.form, {
- productList,
- // purchaseTypeName: this.getDictValue(
- // '采购订单类型',
- // this.form.purchaseType
- // ),
- sourceTypeName: this.requirementSourceType.find(
- (val) => val.value == this.form.sourceType
- )?.label,
- receiptPaymentList: this.$refs?.paymentCollectionPlanRef?.getTableValue() || [],
- endSettlementDate: this.form.settlementDate.length ?this.form.settlementDate[1] : '',
- startSettlementDate: this.form.settlementDate.length ? this.form.settlementDate[0] : ''
- });
- const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);
- if(+ratioSum != 100){
- this.$message.error('比例合计必须为100%');
- return;
- }
- // 使用万分之一进行计算,避免浮点数精度问题(对应4位小数)
- let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
- const payAmount = +commitData.payAmount;
-
- if(+ratioSum == 100) {
- // 使用万分之一进行计算,避免浮点数精度问题
- const difference = Math.round((payAmount - receiptPaymentListSum) * 10000) / 10000;
- if (Math.abs(difference) >= 0.0001 && commitData.receiptPaymentList.length > 0) {
- const lastIndex = commitData.receiptPaymentList.length - 1;
- // 使用万分之一进行计算,避免浮点数精度问题
- const newPrice = Math.round((+commitData.receiptPaymentList[lastIndex].price + difference) * 10000) / 10000;
- commitData.receiptPaymentList[lastIndex].price = formatPrice(newPrice);
- receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
- }
- }
- if(Math.abs(+receiptPaymentListSum - payAmount) > 0.0001){
- this.$message.error('计划收款金额合计与优惠后金额不一致');
- return;
- }
- if (this.isUpdate) {
- UpdateInformation(commitData)
- .then((res) => {
- this.loading = false;
- this.$message.success('修改成功');
- updateRelationStatus([this.form.partbId]);
- if (this.form.contractId) {
- updateContractStatus([this.form.contractId]);
- }
- if (type === 'sub') {
- this.sub(res);
- return;
- }
- this.cancel();
- this.$emit('done');
- })
- .catch((e) => {
- //this.loading = false;
- });
- } else {
- addInformation(commitData)
- .then((res) => {
- this.loading = false;
- this.$message.success('新增成功');
- updateRelationStatus([this.form.partbId]);
- if (type === 'sub') {
- this.sub(res);
- return;
- }
- this.cancel();
- this.$emit('done');
- })
- .catch((e) => {
- //this.loading = false;
- });
- }
- } catch (error) {
- console.log(error);
- // 表单验证未通过,不执行保存操作
- }
- },
- async sub(res) {
- const data = await getpurchaseorderDetail(this.businessId || res);
- this.processSubmitDialogFlag = true;
- this.$nextTick(() => {
- let params = {
- businessId: data.id,
- businessKey: 'purchase_order_approve',
- formCreateUserId: data.createUserId,
- variables: {
- businessCode: data.orderNo,
- businessName: data.partaName,
- businessType: data.sourceTypeName
- }
- // callBackMethodType : '1',
- // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
- // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
- // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
- // miniHandle : '',
- // miniView : '',
- };
- this.$refs.processSubmitDialogRef.init(params);
- });
- // submit({
- // businessId: this.businessId || res
- // }).then((res) => {
- // this.cancel();
- // this.$emit('done');
- // });
- },
- reload() {
- this.cancel();
- this.$emit('done');
- },
- cancel() {
- this.$nextTick(() => {
- this.isFlag = false;
- // 关闭后,销毁所有的表单数据
- this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
- this.$refs['formRef'] && this.$refs['formRef'].resetFields();
- this.$store.commit('order/clearUserData');
- this.form = copyObj(this.formDef);
- this.visible = false;
- });
- },
- //查找合同分类对应name
- findNameById(tree, targetId) {
- for (let i = 0; i < tree.length; i++) {
- const node = tree[i];
- if (node.id === targetId) {
- return node.name;
- }
- if (node.children && node.children.length > 0) {
- const name = this.findNameById(node.children, targetId);
- if (name) {
- return name;
- }
- }
- }
- return null;
- },
- // 日期范围变化
- settlementDateChange(val) {
- // console.log(val);
- let dateRange = [];
- if(this.form.settlementMode == 1) {
- // // this.transformDays(val)
- dateRange = this.transformDaysFun(val);
- }
- if(this.form.settlementMode == 2) {
- // // this.transformMonth(val)
- dateRange = this.transformMonthFun(val, this.form.receiptDate);
- }
- console.log('dateRange~~~', dateRange);
- this.$set(this.form, 'issueNumber', dateRange.length);
- // this.setDefaultList(dateRange)
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, this.form.issueNumber, dateRange);
- },
- // 收款日变化
- receiptDateChange(v) {
- // this.transformMonth(this.form.settlementDate)
- if(this.form.settlementDate.length > 0 && this.form.issueNumber) {
- const dateRange = this.transformMonthFun(this.form.settlementDate, v);
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, this.form.issueNumber, dateRange);
- }
- },
- // 期数变化
- issueNumberChange(v) {
- let dateRange = [];
- if(this.form.settlementMode == 1) {
- dateRange = this.transformDaysFun(this.form.settlementDate, v);
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v, dateRange);
- } else if(this.form.settlementMode == 2) {
- dateRange = this.transformMonthFun(this.form.settlementDate, v);
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v, dateRange);
- } else {
- this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v);
- }
- },
- transformDaysFun(date) {
- const startDate = new Date(date[0]);
- const endDate = new Date(date[1]);
- // 计算毫秒差并转换为天数,使用Math.ceil确保结果为整数
- const days = Math.ceil((endDate - startDate) / (1000 * 60 * 60 * 24)) + 1;
- console.log('包含两头的天数:', days);
- // 生成包括头尾在内的所有日期
- const allDates = [];
- const current = new Date(startDate);
-
- // 遍历从开始日期到结束日期的所有天数
- while (current <= endDate) {
- // 格式化日期为YYYY-MM-dd
- const year = current.getFullYear();
- const month = current.getMonth() + 1; // 月份从0开始,需要+1
- const day = current.getDate();
-
- const formattedMonth = String(month).padStart(2, '0');
- const formattedDay = String(day).padStart(2, '0');
- const formattedDateStr = `${year}-${formattedMonth}-${formattedDay}`;
-
- allDates.push(formattedDateStr);
-
- // 移动到下一天
- current.setDate(current.getDate() + 1);
- }
- return allDates;
- },
- transformMonthFun(date, day) {
- // 处理月份数据(转换为Date对象)
- const parseMonthDate = (dateStr) => {
- return dateStr instanceof Date ? dateStr : new Date(dateStr + '-01');
- };
-
- const start = parseMonthDate(date[0]);
- const end = parseMonthDate(date[1]);
-
- // 先生成所有月份的日期数组
- const allMonthDates = [];
- const currentDate = new Date(start);
-
- // 遍历从开始月份到结束月份的所有月份
- while (currentDate <= end) {
- const year = currentDate.getFullYear();
- const month = currentDate.getMonth() + 1; // 月份从0开始,需要+1
- const receiptDate = day;
-
- // 格式化日期为YYYY-MM-dd
- const formattedMonth = String(month).padStart(2, '0');
- const formattedDate = String(receiptDate).padStart(2, '0');
- const deadLine = receiptDate ? `${year}-${formattedMonth}-${formattedDate}` : '';
-
- allMonthDates.push(deadLine);
-
- // 使用Date对象的setMonth方法正确移动到下一个月(自动处理年份变化)
- currentDate.setMonth(currentDate.getMonth() + 1);
- }
- return allMonthDates;
- },
- }
- };
- </script>
- <style scoped lang="scss">
- .TotalAmount {
- font-size: 16px;
- padding-right: 30px;
- }
- </style>
|