1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047 |
- <template>
- <div style="width: 100%; padding: 0px 15px">
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
- <template #btn>
- <div>
- <el-button type="primary" v-if="
- route.query.processType==30 || !route.query.processType
- " @click="clickCopy">复制采购订单</el-button>
- </div>
- </template>
- <template #buyer>
- <div style="width: 100%">
- <el-form-item prop="buyCorporationId">
- <el-select v-model="formData.data.buyCorporationId" style="width: 100%" @change="changeBuyCorporation">
- <el-option v-for="item in corporationList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="8">
- <el-form-item label="地址" prop="buyCountryName">
- <el-input v-model="formData.data.buyCountryName" placeholder="请输入国家" @change="changeAddress" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label=" " prop="buyProvinceName">
- <el-input v-model="formData.data.buyProvinceName" placeholder="请输入省/州" @change="changeAddress" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label=" " prop="buyCityName">
- <el-input v-model="formData.data.buyCityName" placeholder="请输入城市" @change="changeAddress" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="24">
- <el-form-item prop="buyAddress">
- <el-input v-model="formData.data.buyAddress" type="textarea" @change="changeAddress" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="8">
- <el-form-item label="联系人" prop="buyContactName">
- <el-input v-model="formData.data.buyContactName" placeholder="请输入联系人" />
- </el-form-item>
- </el-col>
- <el-col :span="16">
- <el-form-item label=" " prop="buyContactNumber">
- <el-input v-model="formData.data.buyContactNumber" placeholder="请输入联系人电话" />
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </template>
- <template #seller>
- <div style="width: 100%">
- <div style="width: 100%">
- <el-form-item prop="sellCorporationId">
- <el-select v-model="formData.data.sellCorporationId" style="width: 100%" filterable remote reserve-keyword placeholder="请输入关键字"
- remote-show-suffix :remote-method="remoteMethod" :loading="loadingSearch" @input="remoteMethod" @change="changeSupplier"
- v-if="
- route.query.processType==30 ||
- !route.query.processType
- ">
- <el-option v-for="item in supplierList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- <el-select v-model="formData.data.sellCorporationName" disabled v-else style="width: 100%">
- </el-select>
- </el-form-item>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="6">
- <el-form-item label="地址" prop="countryId">
- <el-select v-model="formData.data.countryId" placeholder="国家" filterable @change="(val) => changeSellAddress(val, '20')">
- <el-option v-for="item in countryData" :label="item.chineseName" :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label=" " prop="provinceName">
- <selectCity placeholder="省/洲" @change="(val) => changeSellAddress(val, '30')" addressId="provinceId" addressName="provinceName"
- v-model="formData.data" :data="provinceData">
- </selectCity>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label=" " prop="cityName">
- <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="formData.data" :data="cityData"
- @change="changeAddress">
- </selectCity>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label=" " prop="sellPostalCode">
- <el-input v-model="formData.data.sellPostalCode" placeholder="请输入邮编" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="24">
- <el-form-item prop="sellAddress">
- <el-input v-model="formData.data.sellAddress" type="textarea" @change="changeAddress" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="8">
- <el-form-item label="联系人" prop="sellContactName">
- <el-input v-model="formData.data.sellContactName" placeholder="请输入联系人" />
- </el-form-item>
- </el-col>
- <el-col :span="16">
- <el-form-item label=" " prop="sellContactNumber">
- <el-input v-model="formData.data.sellContactNumber" placeholder="请输入联系人电话" />
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </div>
- </template>
- <template #payment>
- <div style="width: 100%">
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="6">
- <el-form-item label="付款方式" prop="paymentMethod">
- <el-select v-model="formData.data.paymentMethod" placeholder="请选择付款方式" style="width: 100%">
- <el-option v-for="item in fundsPaymentMethod" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="发票类型" prop="invoiceType">
- <el-select v-model="formData.data.invoiceType" placeholder="请选择发票类型" style="width: 100%">
- <el-option v-for="item in invoiceType" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </template>
- <template #delivery>
- <div style="width: 100%">
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="12">
- <el-form-item label="交货类型" prop="deliveryType">
- <el-radio-group v-model="formData.data.deliveryType" @change="changeAddress">
- <el-radio v-for="(item, index) in deliveryType" :key="index" :label="item.value" border>{{ item.label }}</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="12">
- <el-form-item label="详细地址" prop="address">
- <el-input v-model="formData.data.address" :rows="2" type="textarea" placeholder="请输入详细地址" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="6">
- <el-form-item label="交付日期" prop="deliveryTime">
- <el-date-picker v-model="formData.data.deliveryTime" type="date" placeholder="请选择交付日期" value-format="YYYY-MM-DD" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="质保期 (天)" prop="warranty">
- <el-input-number onmousewheel="return false;" v-model="formData.data.warranty" placeholder="请输入质保期" style="width: 100%" :precision="0"
- :controls="false" :min="0" />
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </template>
- <template #commodity>
- <div style="width: 100%" v-if="
- formData.data.purchaseProductList &&
- formData.data.purchaseProductList.length > 0
- ">
- <div :style="
- index !== formData.data.purchaseProductList.length - 1
- ? 'margin-bottom: 20px'
- : ''
- " v-for="(item, index) in formData.data.purchaseProductList" :key="item.dataResourceId">
- <div style="
- border: 1px solid #ccc;
- padding: 20px 10px 0 10px;
- width: 100%;
- ">
- <el-row style="
- width: 100%;
- font-weight: 700;
- background: #eee;
- padding: 10px 0px;
- " :gutter="5" type="flex" align="middle">
- <el-col :span="1" style="text-align: center">
- <img v-if="item.fileUrl" :src="item.fileUrl" class="pic" style="width: 30px; height: 30px" @click="onPicture(item.fileUrl)" />
- </el-col>
- <el-col :span="4">
- <span>产品名称: {{ item.productName }}</span>
- </el-col>
- <el-col :span="4">
- <span>尺寸: {{ item.productModel }}</span>
- </el-col>
- <el-col :span="3"> </el-col>
- <el-col :span="2">
- <span>数量: {{ item.quantity }}</span>
- </el-col>
- <el-col :span="3">
- <span>单价: {{ item.price }}</span>
- </el-col>
- <el-col :span="3">
- <span>金额小计: {{ item.amount }}</span>
- </el-col>
- <el-col :span="2">
- <!-- <el-button
- type="primary"
- text
- @click="handleHandover(item, index)"
- >编辑备注</el-button
- > -->
- <div style="color: #409eff; cursor: pointer" @click="handleHandover(item, index)">
- 编辑备注
- </div>
- </el-col>
- <el-col :span="2">
- <el-button type="primary" text @click="handleMaterial(index)">添加配件</el-button>
- </el-col>
- </el-row>
- <el-collapse v-model="item.activeName" class="hideCollapse" accordion>
- <el-collapse-item title="" :name="true">
- <div style="padding: 0 40px">
- <el-table :data="item.purchaseProductMountingsList" style="width: 100%">
- <el-table-column label="图片" align="center" width="80">
- <template #default="{ row }">
- <img v-if="row.fileUrl" :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
- </template>
- </el-table-column>
- <el-table-column label="类型" align="center" width="80">
- <template #default="{ row }">
- <div>
- {{ dictValueLabel(row.productType, productType) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column label="产品名称" prop="productName" min-width="180" />
- <el-table-column label="尺寸" prop="productModel" min-width="140" />
- <el-table-column label="单价" width="160">
- <template #default="{ row, $index }">
- <div style="width: 100%" class="removePadding">
- <el-form-item :prop="
- 'purchaseProductList.' +
- index +
- '.purchaseProductMountingsList.' +
- $index +
- '.price'
- " :rules="rules.price" :inline-message="true" @change="
- () => {
- return changeProductMaterial(index, $index);
- }
- ">
- <div style="display:flex">
- <el-input-number onmousewheel="return false;" v-model="row.price" style="width: 100%" placeholder="请输入单价"
- :precision="2" :controls="false" :min="0" />
- <el-popover placement="top-start" :width="400" trigger="hover" @show="showEcharts(row,$index)">
- <template #default>
- <div>
- <div>
- <img src="@/assets/images/money1.png" alt="" class="img" />
- <span style="font-size:14px;font-weight:700;color:#000"> 该供应商近期采购单价:</span>
- <div style="padding:5px 0px 0px 20px">
- <div v-for="(item,index) in row.supplyPurchaseProductPriceList" :key="index">
- <span>{{item.createTime.slice(0,10)}} </span>
- <span style="margin-left:40px">CNY {{moneyFormat(item.price,2)}} </span>
- </div>
- </div>
- </div>
- <div style="margin-top:15px">
- <img src="@/assets/images/money2.png" alt="" class="img" />
- <span style="font-size:14px;font-weight:700;color:#000"> 供货推荐:</span>
- <div style="padding:5px 0px 0px 20px">
- <div v-for="(item,index) in row.topPriceList " :key="index">
- <span>{{item.supplierName}} </span>
- <span style="margin-left:40px"> CNY {{moneyFormat(item.price,2)}} </span>
- </div>
- </div>
- </div>
- <div style="margin-top:15px">
- <img src="@/assets/images/money3.png" alt="" class="img" />
- <span style="font-size:14px;font-weight:700;color:#000"> 近期采购单价:</span>
- <div style="padding:5px 0px 0px 20px">
- <div v-for="(item,index) in row.purchaseProductPriceList " :key="index">
- <span>{{item.createTime.slice(0,10)}} </span>
- <span style="margin-left:40px"> CNY {{moneyFormat(item.price,2)}} </span>
- </div>
- </div>
- </div>
- <div :ref="row.productId+$index" :id="row.productId+$index" style="height:180px">
- </div>
- </div>
- </template>
- <template #reference>
- <div style="margin-left:10px;cursor:pointer;position:relative;top:4px">
- <el-icon :size="20" color="#85c1a6">
- <WarningFilled />
- </el-icon>
- </div>
- </template>
- </el-popover>
- </div>
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="数量" width="140">
- <template #default="{ row, $index }">
- <div style="width: 100%" class="removePadding">
- <el-form-item :prop="
- 'purchaseProductList.' +
- index +
- '.purchaseProductMountingsList.' +
- $index +
- '.quantity'
- " :rules="rules.quantity" :inline-message="true" @change="
- () => {
- return changeProductMaterial(index, $index);
- }
- ">
- <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入数量" :precision="0"
- :controls="false" :min="0" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="金额" prop="amount" width="100" />
- <el-table-column label="操作" align="center" width="80" fixed="right">
- <template #default="{ $index }">
- <el-button type="primary" v-if="$index !== 0" link @click="handleRemove(index, $index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </el-collapse-item>
- </el-collapse>
- <div style="text-align: center; margin-top: -18px">
- <el-button type="primary" @click="item.activeName = !item.activeName" style="margin-bottom: -28px; background: #fff" text>
- <span v-if="item.activeName">
- <span style="vertical-align: middle">收起明细</span>
- <el-icon style="
- margin-left: 8px;
- transform: rotate(-90deg);
- vertical-align: middle;
- ">
- <DArrowRight />
- </el-icon>
- </span>
- <span v-else>
- <span style="vertical-align: middle">查看明细</span>
- <el-icon style="
- margin-left: 8px;
- transform: rotate(90deg);
- vertical-align: middle;
- ">
- <DArrowRight />
- </el-icon>
- </span>
- </el-button>
- </div>
- </div>
- </div>
- </div>
- </template>
- <template #otherCharge>
- <div style="width: 100%">
- <el-button type="primary" @click="clickAdd()">添加行</el-button>
- <el-table :data="formData.data.purchaseProjectList" style="width: 100%; margin-top: 16px">
- <el-table-column label="收费项目" width="220">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'purchaseProjectList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
- <el-autocomplete v-model="row.payName" :fetch-suggestions="querySearch" clearable class="inline-input w-50"
- placeholder="请输入收费项目" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="备注">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'purchaseProjectList.' + $index + '.remark'">
- <el-input v-model="row.remark" placeholder="请输入备注" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="金额" width="130">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'purchaseProjectList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true" class="shrinkPadding"
- @change="changeProject">
- <el-input-number onmousewheel="return false;" v-model="row.amount" placeholder="请输入金额" style="width: 100%" :precision="2"
- :controls="false" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="60" align="center" fixed="right">
- <template #default="{ $index }">
- <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #offerMoney>
- <div style="width: 100%; display: flex">
- <div style="width: calc(100% - 190px)"></div>
- <div style="width: 130px; padding: 0 12px">
- <el-form-item label="合同总金额" prop="amount" class="shrinkPadding">
- <el-input v-model="formData.data.amount" placeholder="合同总金额" disabled />
- </el-form-item>
- </div>
- </div>
- </template>
- <template #contractClause>
- <div style="width: 100%">
- <el-row style="margin-top: 20px; width: 100%">
- <el-col :span="8">
- <el-form-item label="合同模板" prop="contractTemplateId">
- <el-select v-model="formData.data.contractTemplateId" style="width: 100%" @change="changeContractTemplate">
- <el-option v-for="item in templateList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <div style="margin-top: 20px; width: 100%">
- <el-form-item label="条款内容" prop="remark">
- <!-- <div v-if="judgeStatus()">
- <div v-html="getHtmlVal(formData.data.remark)"></div>
- </div> -->
- <Editor style="width: 100%" :value="formData.data.remark" @updateValue="updateContent" :readOnly="judgeStatus()" ref="remarkEditor" />
- </el-form-item>
- </div>
- </div>
- </template>
- <template #shipment>
- <div style="width: 100%">
- <el-table :data="formData.data.purchaseArrivalList" style="width: 100%; margin-top: 16px">
- <el-table-column prop="productCode" label="商品编码" width="120" />
- <el-table-column prop="productName" label="商品名称" />
- <el-table-column label="到货日期" width="220">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'purchaseArrivalList.' + $index + '.arrivalTime'" :rules="rules.arrivalTime" :inline-message="true">
- <el-date-picker v-model="row.arrivalTime" type="date" placeholder="请选择到货日期" value-format="YYYY-MM-DD" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="到货数量" width="160">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'purchaseArrivalList.' + $index + '.quantity'" :inline-message="true">
- <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入到货数量" style="width: 100%" :precision="0"
- :controls="false" :min="0" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" label="操作" width="120" fixed="right">
- <template #default="{ row, $index }">
- <el-button type="primary" link @click="clickSplit(row)">拆分</el-button>
- <el-button type="primary" link @click="clickDelete($index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </byForm>
- <el-dialog v-if="openMaterialCompany" v-model="openMaterialCompany" title="物料选择" width="90%" append-to-body>
- <SelectMaterial :alreadySelectData="alreadySelectData" @handleSelect="selectMaterial"></SelectMaterial>
- </el-dialog>
- <el-dialog title="备注" v-if="openHandover" v-model="openHandover" width="800">
- <byForm :formConfig="formHandoverConfig" :formOption="formOption" v-model="productRow.data">
- <template #file>
- <div style="width: 100%">
- <el-upload v-model:fileList="fileList" :action="uploadUrl" :data="uploadData" multiple :before-upload="uploadFile"
- :on-success="handleSuccess" :on-preview="onPreviewFile">
- <el-button>选择</el-button>
- </el-upload>
- </div>
- </template>
- <template #remark>
- <div style="width: 100%">
- <Editor :value="productRow.data.remark" @updateValue="updateHandover" />
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="openHandover = false" size="default">取 消</el-button>
- <el-button type="primary" @click="submitHandoverForm()" size="default">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog v-if="copyContract" v-model="copyContract" title="采购订单选择" width="90%" append-to-body>
- <SelectPurchase @select="selectPurchase"></SelectPurchase>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import byForm from "@/components/byForm/index";
- import SelectMaterial from "@/components/product/SelectMaterial.vue";
- import SelectPurchase from "@/components/contractCom/selectPurchase.vue";
- import { ElMessage } from "element-plus";
- import selectCity from "@/components/selectCity/index.vue";
- import Editor from "@/components/Editor/index.vue";
- import { useRoute } from "vue-router";
- import useUserStore from "@/store/modules/user";
- import * as echarts from "echarts";
- import $bus from "@/bus/index.js";
- const alreadySelectData = ref([]);
- const userInfo = useUserStore();
- const route = useRoute();
- const { proxy } = getCurrentInstance();
- const invoiceType = ref([]);
- const fundsPaymentMethod = ref([]);
- const templateList = ref([]);
- const corporationList = ref([]);
- const supplierList = ref([]);
- const countryData = ref([]);
- const provinceData = ref([]);
- const cityData = ref([]);
- const openMaterialCompany = ref(false);
- const copyContract = ref(false);
- const formData = reactive({
- data: {
- deliveryType: "1",
- remark: "",
- amount: undefined,
- purchaseArrivalList: [],
- purchaseProductList: [],
- purchaseProjectList: [],
- },
- });
- const submit = ref(null);
- const deliveryType = ref([
- {
- label: "买方地址",
- value: "1",
- },
- {
- label: "工厂交付",
- value: "2",
- },
- {
- label: "其他",
- value: "3",
- },
- ]);
- const productType = ref([
- {
- label: "产品",
- value: 1,
- },
- {
- label: "物料",
- value: 2,
- },
- ]);
- const judgeStatus = () => {
- if (route.query.processType == 20 || route.query.processType == 10) {
- return true;
- }
- if (props.queryData.recordList && props.queryData.recordList.length > 0) {
- let data = props.queryData.recordList.filter(
- (item) => item.status === 2 && item.nodeType !== 1
- );
- if (data && data.length > 0) {
- return true;
- }
- }
- return false;
- };
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- disabled: false,
- });
- const formConfig = computed(() => {
- return [
- {
- type: "slot",
- slotName: "btn",
- label: "",
- },
- {
- type: "slot",
- slotName: "buyer",
- label: "买方信息",
- itemWidth: 50,
- },
- {
- type: "slot",
- slotName: "seller",
- label: "卖方信息",
- itemWidth: 50,
- },
- {
- type: "title",
- title: "付款信息",
- haveLine: true,
- },
- {
- type: "slot",
- slotName: "payment",
- label: "",
- },
- {
- type: "title",
- title: "交付信息",
- haveLine: true,
- },
- {
- type: "slot",
- slotName: "delivery",
- label: "",
- },
- {
- type: "title",
- title: "采购明细",
- haveLine: true,
- },
- {
- type: "slot",
- slotName: "commodity",
- label: "",
- },
- {
- type: "title",
- title: "其他收费项目",
- haveLine: true,
- },
- {
- type: "slot",
- slotName: "otherCharge",
- label: "",
- },
- {
- type: "slot",
- slotName: "offerMoney",
- },
- {
- type: "title",
- title: "合同条款",
- haveLine: true,
- },
- {
- type: "slot",
- slotName: "contractClause",
- label: "",
- },
- {
- type: "title",
- title: "到货要求",
- haveLine: true,
- },
- {
- type: "slot",
- slotName: "shipment",
- label: "",
- },
- ];
- });
- const rules = ref({
- buyCorporationId: [
- { required: true, message: "请选择买方公司", trigger: "change" },
- ],
- sellCorporationId: [
- { required: true, message: "请选择卖方公司", trigger: "change" },
- ],
- countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
- sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
- buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
- sellContactName: [
- { required: true, message: "请输入联系人", trigger: "blur" },
- ],
- sellContactNumber: [
- { required: true, message: "请输入联系电话", trigger: "blur" },
- ],
- quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
- price: [{ required: true, message: "请输入单价", trigger: "blur" }],
- amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
- payName: [
- { required: true, message: "请输入收费项目", trigger: ["change", "blur"] },
- ],
- warranty: [{ required: true, message: "请输入质保期", trigger: "blur" }],
- deliveryType: [
- { required: true, message: "请选择交货类型", trigger: "change" },
- ],
- address: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
- deliveryTime: [
- { required: true, message: "请选择交付日期", trigger: "change" },
- ],
- paymentMethod: [
- { required: true, message: "请选择付款方式", trigger: "change" },
- ],
- invoiceType: [
- { required: true, message: "请选择发票类型", trigger: "change" },
- ],
- contractTemplateId: [
- { required: true, message: "请选择合同模板", trigger: "change" },
- ],
- remark: [{ required: true, message: "请输入条款内容", trigger: "change" }],
- });
- const getDict = () => {
- proxy.getDictOne(["invoice_type", "funds_payment_method"]).then((res) => {
- invoiceType.value = res["invoice_type"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- });
- proxy
- .post("/contractTemplate/page", { pageNum: 1, pageSize: 999 })
- .then((res) => {
- templateList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.templateName,
- value: item.id,
- };
- });
- });
- proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- corporationList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.name,
- value: item.id,
- };
- });
- });
- proxy.post("/supplierInfo/page", { pageNum: 1, pageSize: 50 }).then((res) => {
- supplierList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.name,
- value: item.id,
- };
- });
- });
- };
- getDict();
- const getCityData = (id, type, isChange) => {
- return proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
- if (type === "20") {
- provinceData.value = res;
- if (isChange) {
- formData.data.provinceId = "";
- formData.data.provinceName = "";
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else if (type === "30") {
- cityData.value = res;
- if (isChange) {
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else {
- countryData.value = res;
- }
- });
- };
- getCityData("0");
- const changeBuyCorporation = (val) => {
- formData.data.buyCountryName = "";
- formData.data.buyProvinceName = "";
- formData.data.buyCityName = "";
- formData.data.buyAddress = "";
- if (val) {
- proxy.post("/corporation/detail", { id: val }).then((res) => {
- formData.data.buyAddress = res.address;
- Promise.all([
- getBuyCountryName(res.countryId),
- getBuyProvinceName(res.provinceId, res.countryId),
- getBuyCityName(res.cityId, res.provinceId),
- ]).then(() => {
- changeAddress();
- });
- });
- }
- };
- const changeAddress = () => {
- if (formData.data.deliveryType === "1") {
- let buyCountryName = "";
- if (formData.data.buyCountryName) {
- buyCountryName = formData.data.buyCountryName;
- }
- let buyProvinceName = "";
- if (formData.data.buyProvinceName) {
- buyProvinceName = formData.data.buyProvinceName;
- }
- let buyCityName = "";
- if (formData.data.buyCityName) {
- buyCityName = formData.data.buyCityName;
- }
- let buyAddress = "";
- if (formData.data.buyAddress) {
- buyAddress = formData.data.buyAddress;
- }
- formData.data.address =
- buyCountryName +
- ", " +
- buyProvinceName +
- ", " +
- buyCityName +
- "," +
- buyAddress;
- } else if (formData.data.deliveryType === "2") {
- let countryName = "";
- if (formData.data.countryId) {
- let data = countryData.value.filter(
- (item) => item.id === formData.data.countryId
- );
- if (data && data.length > 0) countryName = data[0].chineseName;
- }
- let provinceName = "";
- if (formData.data.provinceId) {
- let data = provinceData.value.filter(
- (item) => item.id === formData.data.provinceId
- );
- if (data && data.length > 0) provinceName = data[0].name;
- } else {
- if (formData.data.provinceName) {
- provinceName = formData.data.provinceName;
- }
- }
- let cityName = "";
- if (formData.data.cityId) {
- let data = cityData.value.filter(
- (item) => item.id === formData.data.cityId
- );
- if (data && data.length > 0) cityName = data[0].name;
- } else {
- if (formData.data.cityName) {
- cityName = formData.data.cityName;
- }
- }
- let sellAddress = "";
- if (formData.data.sellAddress) {
- sellAddress = formData.data.sellAddress;
- }
- formData.data.address =
- countryName + ", " + provinceName + ", " + cityName + "," + sellAddress;
- } else if (formData.data.deliveryType === "3") {
- formData.data.address = "";
- }
- };
- const changeSellAddress = (val, index) => {
- Promise.all([getCityData(val, index, true)]).then(() => {
- changeAddress();
- });
- };
- const getBuyCountryName = (val) => {
- return proxy
- .post("/customizeArea/list", { parentId: "0" })
- .then((resCountry) => {
- let buyCountryData = resCountry.filter((item) => item.id === val);
- if (buyCountryData && buyCountryData.length > 0) {
- formData.data.buyCountryName = buyCountryData[0].chineseName;
- } else {
- formData.data.buyCountryName = "";
- }
- });
- };
- const getBuyProvinceName = (val, countryId) => {
- if (val) {
- return proxy
- .post("/customizeArea/list", { parentId: countryId })
- .then((resProvince) => {
- let buyProvinceData = resProvince.filter((item) => item.id === val);
- if (buyProvinceData && buyProvinceData.length > 0) {
- formData.data.buyProvinceName = buyProvinceData[0].name;
- } else {
- formData.data.buyProvinceName = "";
- }
- });
- } else {
- formData.data.buyProvinceName = "";
- return;
- }
- };
- const getBuyCityName = (val, provinceId) => {
- if (val) {
- return proxy
- .post("/customizeArea/list", { parentId: provinceId })
- .then((resCity) => {
- let buyCityData = resCity.filter((item) => item.id === val);
- if (buyCityData && buyCityData.length > 0) {
- formData.data.buyCityName = buyCityData[0].name;
- } else {
- formData.data.buyCityName = "";
- }
- });
- } else {
- formData.data.buyCityName = "";
- return;
- }
- };
- const changeProductPrice = () => {
- let productIds = [];
- for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
- const iele = formData.data.purchaseProductList[i];
- for (let j = 0; j < iele.purchaseProductMountingsList.length; j++) {
- const jele = iele.purchaseProductMountingsList[j];
- productIds.push(jele.productId);
- }
- }
- if (productIds && productIds.length > 0) {
- proxy
- .post("/ehsdPurchase/getProductPriceInfo", {
- productIds: productIds,
- sellCorporationId: formData.data.sellCorporationId
- ? formData.data.sellCorporationId
- : "",
- })
- .then((resOne) => {
- for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
- const iele = formData.data.purchaseProductList[i];
- for (let j = 0; j < iele.purchaseProductMountingsList.length; j++) {
- const jele = iele.purchaseProductMountingsList[j];
- for (const key in resOne) {
- if (jele.productId == key) {
- jele.purchaseProductPriceList = resOne[key].purchaseProductList
- .map((x) => ({
- createTime: x.createTime,
- price: x.price,
- }))
- .filter((y, index) => index < 3);
- jele.purchaseProductPriceListOne = resOne[
- key
- ].purchaseProductList.map((x) => ({
- createTime: x.createTime,
- price: x.price,
- }));
- jele.topPriceList = resOne[key].topPriceList
- .map((x) => ({
- supplierName: x.supplierName,
- price: x.price,
- }))
- .filter((y, index) => index < 3);
- jele.supplyPurchaseProductPriceList = resOne[
- key
- ].supplyPurchaseProductList
- .map((x) => ({
- createTime: x.createTime,
- price: x.price,
- }))
- .filter((y, index) => index < 3);
- }
- }
- }
- }
- });
- }
- };
- const changeSupplier = (val) => {
- changeProductPrice();
- formData.data.countryId = "";
- formData.data.provinceId = "";
- formData.data.cityId = "";
- formData.data.sellPostalCode = "";
- formData.data.sellAddress = "";
- formData.data.sellContactName = "";
- formData.data.sellContactNumber = "";
- if (val) {
- let data = supplierList.value.filter((item) => item.id === val);
- if (data && data.length > 0) {
- formData.data.countryId = data[0].countryId;
- formData.data.provinceId = data[0].provinceId;
- formData.data.cityId = data[0].cityId;
- formData.data.sellAddress = data[0].areaDetail;
- formData.data.sellContactName = data[0].contactPerson;
- formData.data.sellContactNumber = data[0].contactNumber;
- if (formData.data.provinceId) {
- Promise.all([
- getCityData(formData.data.countryId, "20"),
- getCityData(formData.data.provinceId, "30"),
- ]).then(() => {
- changeAddress();
- });
- } else {
- Promise.all([getCityData(formData.data.countryId, "20")]).then(() => {
- changeAddress();
- });
- }
- }
- const ids = formData.data.purchaseProductList.map((x) => x.productId);
- getAuxiliaryData(val, ids);
- }
- };
- const onPicture = (path) => {
- window.open(path, "_blank");
- };
- const changeProject = () => {
- nextTick(() => {
- calculationAllAmount();
- });
- };
- const calculationAllAmount = () => {
- let amount = 0;
- if (
- formData.data.purchaseProductList &&
- formData.data.purchaseProductList.length > 0
- ) {
- for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
- if (formData.data.purchaseProductList[i].amount) {
- amount = Number(
- parseFloat(
- Number(amount) + Number(formData.data.purchaseProductList[i].amount)
- ).toFixed(2)
- );
- }
- }
- }
- if (
- formData.data.purchaseProjectList &&
- formData.data.purchaseProjectList.length > 0
- ) {
- for (let i = 0; i < formData.data.purchaseProjectList.length; i++) {
- if (formData.data.purchaseProjectList[i].amount) {
- amount = Number(
- parseFloat(
- Number(amount) + Number(formData.data.purchaseProjectList[i].amount)
- ).toFixed(2)
- );
- }
- }
- }
- formData.data.amount = amount;
- };
- const calculationProductAmount = (index) => {
- if (
- formData.data.purchaseProductList &&
- formData.data.purchaseProductList.length > 0 &&
- formData.data.purchaseProductList[index].purchaseProductMountingsList &&
- formData.data.purchaseProductList[index].purchaseProductMountingsList
- .length > 0
- ) {
- let amount = 0;
- for (
- let i = 0;
- i <
- formData.data.purchaseProductList[index].purchaseProductMountingsList
- .length;
- i++
- ) {
- if (
- formData.data.purchaseProductList[index].purchaseProductMountingsList[i]
- .amount
- ) {
- amount = Number(
- parseFloat(
- Number(amount) +
- Number(
- formData.data.purchaseProductList[index]
- .purchaseProductMountingsList[i].amount
- )
- ).toFixed(2)
- );
- }
- }
- formData.data.purchaseProductList[index].amount = amount;
- let price = 0;
- if (formData.data.purchaseProductList[index].quantity && amount) {
- price = Number(
- parseFloat(
- Number(amount) /
- Number(formData.data.purchaseProductList[index].quantity)
- ).toFixed(4)
- );
- }
- formData.data.purchaseProductList[index].price = price;
- }
- nextTick(() => {
- calculationAllAmount();
- });
- };
- const changeProductMaterial = (index, indexTwo) => {
- nextTick(() => {
- if (
- formData.data.purchaseProductList &&
- formData.data.purchaseProductList.length > 0 &&
- formData.data.purchaseProductList[index].purchaseProductMountingsList &&
- formData.data.purchaseProductList[index].purchaseProductMountingsList
- .length > 0
- ) {
- if (
- indexTwo === 0 &&
- formData.data.purchaseProductList[index].purchaseProductMountingsList[
- indexTwo
- ].quantity
- ) {
- formData.data.purchaseProductList[index].quantity =
- formData.data.purchaseProductList[index].purchaseProductMountingsList[
- indexTwo
- ].quantity;
- }
- if (
- formData.data.purchaseProductList[index].purchaseProductMountingsList[
- indexTwo
- ].quantity &&
- formData.data.purchaseProductList[index].purchaseProductMountingsList[
- indexTwo
- ].price
- ) {
- formData.data.purchaseProductList[index].purchaseProductMountingsList[
- indexTwo
- ].amount = Number(
- parseFloat(
- Number(
- formData.data.purchaseProductList[index]
- .purchaseProductMountingsList[indexTwo].quantity
- ) *
- Number(
- formData.data.purchaseProductList[index]
- .purchaseProductMountingsList[indexTwo].price
- )
- ).toFixed(2)
- );
- } else {
- formData.data.purchaseProductList[index].purchaseProductMountingsList[
- indexTwo
- ].amount = 0;
- }
- }
- nextTick(() => {
- calculationProductAmount(index);
- });
- });
- };
- const handleRemove = async (index, indexTwo) => {
- await formData.data.purchaseProductList[
- index
- ].purchaseProductMountingsList.splice(indexTwo, 1);
- nextTick(() => {
- calculationProductAmount(index);
- });
- };
- const clickAdd = () => {
- if (
- formData.data.purchaseProjectList &&
- formData.data.purchaseProjectList.length > 0
- ) {
- formData.data.purchaseProjectList.push({
- payName: "",
- amount: undefined,
- remark: "",
- });
- } else {
- formData.data.purchaseProjectList = [
- { payName: "", amount: undefined, remark: "" },
- ];
- }
- };
- const handleDelete = async (index) => {
- await formData.data.purchaseProjectList.splice(index, 1);
- nextTick(() => {
- calculationAllAmount();
- });
- };
- const querySearch = (queryString, callback) => {
- proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
- if (res.rows && res.rows.length > 0) {
- res.rows = res.rows.map((item) => {
- return {
- ...item,
- value: item.payName,
- };
- });
- callback(res.rows);
- } else {
- callback([]);
- }
- });
- };
- const handleSubmit = async () => {
- let status = await submit.value.handleSubmit(() => {});
- if (status) {
- // 合同交接单不可大于待采购数量
- if (route.query.type == 1) {
- for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
- const ele = formData.data.purchaseProductList[i];
- for (let j = 0; j < ele.purchaseProductMountingsList.length; j++) {
- const jele = ele.purchaseProductMountingsList[j];
- if (j == 0) {
- if (Number(jele.quantity) > Number(jele.oldQuantity)) {
- ElMessage("采购数量不能大于待采购数量");
- return false;
- }
- }
- }
- }
- }
- // if (
- // formData.data.purchaseArrivalList &&
- // formData.data.purchaseArrivalList.length > 0
- // ) {
- // for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
- // let data = formData.data.purchaseArrivalList.filter(
- // (item) =>
- // item.productId === formData.data.purchaseProductList[i].productId
- // );
- // if (data && data.length > 0) {
- // let quantity = 0;
- // for (let j = 0; j < data.length; j++) {
- // quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
- // }
- // if (quantity > formData.data.purchaseProductList[i].quantity) {
- // ElMessage("到货数量不能大于采购数量");
- // return false;
- // }
- // }
- // }
- // }
- return true;
- } else {
- setTimeout(() => {
- const errorDiv = document.getElementsByClassName("is-error");
- errorDiv[0].scrollIntoView();
- }, 0);
- }
- return status;
- };
- // 接收父组件的传值
- const props = defineProps({
- queryData: Object,
- });
- const getFormData = () => {
- return proxy.deepClone(formData.data);
- };
- // 向父组件暴露
- defineExpose({
- getFormData,
- handleSubmit,
- });
- const getAssociationData = (type, id) => {
- if (type && id) {
- if (type == 1) {
- auxiliaryData.value[0].label = "关联销售订单";
- proxy.post("/contract/detail", { id }).then((res) => {
- contractData.value = [
- {
- contractCode: res.code,
- claimTime: res.createTime,
- },
- ];
- getAuxiliaryData();
- });
- } else if (type == 2) {
- auxiliaryData.value[0].label = "关联样品单";
- proxy.post("/sample/detail", { id }).then((res) => {
- contractData.value = [
- {
- contractCode: res.code,
- claimTime: res.createTime,
- },
- ];
- getAuxiliaryData();
- });
- }
- }
- };
- // 判断当前用户有无销售订单页面权限
- const isHave = ref(false);
- if (userInfo.permissions && userInfo.permissions.includes("contract")) {
- isHave.value = true;
- }
- const handlePushRoute = (row) => {
- proxy.$router.push({
- name: "Contract",
- query: {
- code: row.value,
- },
- });
- };
- // 判断当前用户有无样品单页面权限
- const isHaveOne = ref(false);
- if (userInfo.permissions && userInfo.permissions.includes("sample")) {
- isHaveOne.value = true;
- }
- const handlePushRouteOne = (row) => {
- proxy.$router.push({
- name: "Sample",
- query: {
- code: row.value,
- },
- });
- };
- onMounted(() => {
- if (route.query && route.query.type && route.query.submitType === "10") {
- getAssociationData(route.query.type, route.query.dataResourceId);
- }
- if (props.queryData.ids) {
- proxy.post("/delivery/page", { ids: props.queryData.ids }).then((res) => {
- formData.data.dataResource = props.queryData.type;
- formData.data.dataResourceId = route.query.dataResourceId;
- if (res.rows && res.rows.length > 0) {
- formData.data.purchaseProductList = res.rows.map((item) => {
- return {
- productId: item.productId,
- contractId: item.contractId,
- productName: item.productName,
- productModel: item.productModel,
- quantity: item.expendQuantity,
- oldQuantity: item.expendQuantity,
- price: "",
- amount: "",
- remark: "",
- json: "",
- fileUrl: "",
- dataResource: props.queryData.type,
- dataResourceId: item.id,
- purchaseProductMountingsList: [
- {
- productId: item.productId,
- productType: 1,
- productName: item.productName,
- productModel: item.productModel,
- quantity: item.expendQuantity,
- oldQuantity: item.expendQuantity,
- price: undefined,
- amount: "",
- remark: "",
- json: "",
- fileUrl: "",
- activeName: true,
- },
- ],
- fileList: [],
- };
- });
- formData.data.purchaseArrivalList = res.rows.map((item) => {
- return {
- productCode: item.productCode,
- productId: item.productId,
- productName: item.productName,
- arrivalTime: "",
- quantity: undefined,
- };
- });
- let fileIds = formData.data.purchaseProductList.map(
- (item) => item.productId
- );
- proxy
- .post("/fileInfo/getList", { businessIdList: fileIds })
- .then((resFile) => {
- for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
- if (
- resFile[formData.data.purchaseProductList[i].productId] &&
- resFile[formData.data.purchaseProductList[i].productId].length >
- 0
- ) {
- formData.data.purchaseProductList[i].fileUrl =
- resFile[
- formData.data.purchaseProductList[i].productId
- ][0].fileUrl;
- formData.data.purchaseProductList[
- i
- ].purchaseProductMountingsList[0].fileUrl =
- resFile[
- formData.data.purchaseProductList[i].productId
- ][0].fileUrl;
- }
- }
- });
- // 单价提示
- changeProductPrice();
- } else {
- formData.data.purchaseProductList = [];
- }
- });
- }
- formOption.disabled = judgeStatus();
- if (route.query && route.query.processType) {
- let businessId = route.query.businessId;
- proxy.post("/ehsdPurchase/detail", { id: businessId }).then((res) => {
- // 退回回显
- if (route.query.processType == 30) {
- proxy
- .post("/supplierInfo/page", { keyword: res.sellCorporationName })
- .then((res) => {
- supplierList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.name,
- value: item.id,
- };
- });
- });
- }
- if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
- $bus.emit("getGrossData", res.grossProfitInfoList);
- }
- res.purchaseProductList = res.ehsdPurchaseProductList || [];
- if (!res.fileList) {
- res.fileList = [];
- }
- res.countryId = res.sellCountryId;
- res.provinceId = res.sellProvinceId;
- res.cityId = res.sellCityId;
- for (const key in res) {
- formData.data[key] = res[key];
- }
- remarkEditor.value.changeHtml(formData.data.remark);
- // 回显关联销售订单
- if (route.query && route.query.submitType === "10") {
- getAssociationData(
- formData.data.dataResource,
- formData.data.dataResourceId
- );
- }
- proxy
- .post("/fileInfo/getList", {
- businessIdList: [businessId],
- })
- .then((fileObj) => {
- if (fileObj[businessId]) {
- formData.data.fileList = fileObj[businessId]
- .filter((x) => x.businessType === "1")
- .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
- formData.data.packageFileList = fileObj[businessId]
- .filter((x) => x.businessType === "2")
- .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
- }
- });
- if (
- formData.data.purchaseProductList &&
- formData.data.purchaseProductList.length > 0
- ) {
- let ids = formData.data.purchaseProductList.map((x) => x.productId);
- getAuxiliaryData(formData.data.sellCorporationId, ids);
- proxy
- .post("/fileInfo/getList", {
- businessIdList: ids,
- })
- .then((fileObj) => {
- for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
- const e = formData.data.purchaseProductList[i];
- e.activeName = true;
- for (const key in fileObj) {
- if (e.productId === key) {
- e.fileList = fileObj[key] || [];
- if (e.fileList && e.fileList.length > 0) {
- e.fileUrl = e.fileList[0].fileUrl;
- }
- }
- }
- }
- });
- changeProductPrice();
- }
- if (formData.data.countryId) {
- getCityData(formData.data.countryId, "20");
- }
- if (formData.data.provinceId) {
- getCityData(formData.data.provinceId, "30");
- }
- });
- }
- });
- const clickSplit = (item) => {
- formData.data.purchaseArrivalList.push({
- productCode: item.code,
- productId: item.productId,
- productName: item.productName,
- arrivalTime: "",
- remark: "",
- quantity: undefined,
- });
- };
- const clickDelete = (index) => {
- formData.data.purchaseArrivalList.splice(index, 1);
- };
- const updateContent = (val) => {
- formData.data.remark = val;
- };
- const remarkEditor = ref(null);
- const changeContractTemplate = (val) => {
- if (val) {
- proxy.post("/contractTemplate/detail", { id: val }).then((res) => {
- remarkEditor.value.changeHtml(res.templateContent);
- });
- }
- };
- const productRow = reactive({
- data: {
- productName: "",
- remark: "",
- },
- });
- const productIndex = ref(0);
- const openHandover = ref(false);
- const fileList = ref([]);
- const uploadData = ref({});
- const formHandoverConfig = computed(() => {
- return [
- {
- type: "title",
- title: "产品信息",
- label: "",
- },
- {
- type: "input",
- prop: "productName",
- label: "产品名称",
- itemType: "text",
- disabled: true,
- },
- {
- type: "input",
- prop: "productModel",
- label: "规格型号",
- itemType: "text",
- disabled: true,
- },
- {
- type: "slot",
- prop: "file",
- slotName: "file",
- label: "上传附件",
- },
- {
- type: "slot",
- slotName: "remark",
- label: "备注",
- },
- ];
- });
- const handleHandover = (row, index) => {
- productRow.data = {
- productName: row.productName,
- remark: row.remark,
- };
- if (row.fileList && row.fileList.length > 0) {
- fileList.value = row.fileList.map((item) => {
- return {
- raw: item,
- name: item.fileName,
- url: item.fileUrl,
- };
- });
- } else {
- fileList.value = [];
- }
- productIndex.value = index;
- openHandover.value = true;
- };
- const handleMaterial = (index) => {
- productIndex.value = index;
- alreadySelectData.value = formData.data.purchaseProductList[
- index
- ].purchaseProductMountingsList.filter((x) => x.productType == 2);
- openMaterialCompany.value = true;
- };
- const uploadFile = async (file) => {
- const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
- uploadData.value = res.uploadBody;
- file.id = res.id;
- file.fileName = res.fileName;
- file.fileUrl = res.fileUrl;
- file.uploadState = true;
- return true;
- };
- const handleSuccess = (any, UploadFile) => {
- UploadFile.raw.uploadState = false;
- };
- const onPreviewFile = (file) => {
- window.open(file.raw.fileUrl, "_blank");
- };
- const updateHandover = (val) => {
- productRow.data.remark = val;
- };
- const submitHandoverForm = () => {
- if (fileList.value && fileList.value.length > 0) {
- for (let i = 0; i < fileList.value.length; i++) {
- if (fileList.value[i].raw.uploadState) {
- ElMessage("文件上传中,请稍后提交");
- return;
- }
- }
- formData.data.purchaseProductList[productIndex.value].fileList =
- fileList.value.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- uploadState: item.raw.uploadState,
- };
- });
- } else {
- formData.data.purchaseProductList[productIndex.value].fileList = [];
- }
- formData.data.purchaseProductList[productIndex.value].remark =
- productRow.data.remark;
- openHandover.value = false;
- };
- const selectMaterial = (goods) => {
- if (goods && goods.id) {
- let data = formData.data.purchaseProductList[
- productIndex.value
- ].purchaseProductMountingsList.filter(
- (item) => item.productId === goods.id
- );
- // if (data && data.length > 0) {
- // return ElMessage("该物料已添加");
- // }
- let fileUrl = "";
- if (goods.fileList && goods.fileList.length > 0) {
- fileUrl = goods.fileList[0].fileUrl;
- }
- formData.data.purchaseProductList[
- productIndex.value
- ].purchaseProductMountingsList.push({
- productId: goods.id,
- productType: 2,
- productName: goods.name,
- productModel: goods.spec,
- quantity: undefined,
- price: undefined,
- amount: "",
- remark: "",
- json: "",
- fileUrl: fileUrl,
- activeName: true,
- });
- changeProductPrice();
- ElMessage({
- message: "添加成功!",
- type: "success",
- });
- } else {
- return ElMessage("选择错误");
- }
- };
- const getStyle = (text) => {
- if (text) {
- return text.replace(/\n|\r\n/g, "<br>");
- } else {
- return "";
- }
- };
- const emit = defineEmits(["auxiliaryChange"]);
- let auxiliaryData = ref([
- {
- label: "关联销售订单",
- data: [],
- },
- {
- label: "供应商最近采购",
- data: [],
- },
- {
- label: "产品价格",
- data: [],
- },
- ]);
- const auxiliaryChange = (data) => {
- emit("auxiliaryChange", data);
- };
- const contractData = ref([]);
- const getAuxiliaryData = (supplyId, productIdList) => {
- if (supplyId && productIdList.length > 0) {
- proxy
- .post("/subscribe/decisionAid", {
- supplyId: supplyId,
- productIdList: productIdList,
- })
- .then((res) => {
- // 供应商最近采购
- const recentlyArr = [
- {
- label: "合同编号",
- value: "",
- fn:
- route.query.type == 2
- ? isHaveOne
- ? handlePushRouteOne
- : () => {}
- : isHave
- ? handlePushRoute
- : () => {},
- num: 1,
- },
- {
- label: "下单日期",
- value: "",
- num: 1,
- },
- {
- label: "合同金额",
- value: "",
- num: 1,
- },
- ];
- auxiliaryData.value[1].data = res.purchaseList.map((x, index) => {
- return recentlyArr.map((y, sonIndex) => {
- let obj = { ...y };
- let value = "";
- if (sonIndex === 0) {
- value = x.code;
- } else if (sonIndex === 1) {
- value = x.createTime;
- } else {
- value = x.currency + " " + proxy.moneyFormat(x.amount, 2);
- }
- obj.value = value;
- return obj;
- });
- });
- // 产品价格
- const arrConfig = [
- {
- label: "产品名称",
- value: "",
- num: 1,
- },
- {
- label: "最近价格",
- value: "",
- num: 1,
- },
- {
- label: "历史最高",
- value: "",
- num: 1,
- },
- {
- label: "历史最低",
- value: "",
- num: 1,
- },
- ];
- auxiliaryData.value[2].data = res.productPriceList.map((x, index) => {
- return arrConfig.map((y, sonIndex) => {
- let obj = { ...y };
- let value = "";
- if (sonIndex === 0) {
- value = x.name;
- } else if (sonIndex === 1) {
- value = x.lastPrice;
- } else if (sonIndex === 2) {
- value = x.maxPrice;
- } else {
- value = x.minPrice;
- }
- obj.value = value;
- return obj;
- });
- });
- auxiliaryChange(auxiliaryData.value);
- });
- } else {
- let arrConfig = [
- {
- label: "合同编号",
- value: "",
- fn:
- route.query.type == 2
- ? isHaveOne
- ? handlePushRouteOne
- : () => {}
- : isHave
- ? handlePushRoute
- : () => {},
- num: 1,
- },
- {
- label: "下单日期",
- value: "",
- num: 1,
- },
- ];
- auxiliaryData.value[0].data = contractData.value.map((x, index) => {
- return arrConfig.map((y, sonIndex) => {
- let obj = { ...y };
- let value = "";
- if (sonIndex === 0) {
- value = contractData.value[index].contractCode;
- } else if (sonIndex === 1) {
- value = contractData.value[index].claimTime;
- }
- obj.value = value;
- return obj;
- });
- });
- auxiliaryChange(auxiliaryData.value);
- }
- };
- const getHtmlVal = (val) => {
- if (val) {
- return val.replace(/<p>/g, "<div>").replace(/<\/p>/g, "</div>");
- }
- return "";
- };
- const loadingSearch = ref(false);
- const remoteMethod = (keyword) => {
- if (keyword && typeof keyword === "string") {
- loadingSearch.value = true;
- proxy.post("/supplierInfo/page", { keyword }).then((res) => {
- supplierList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.name,
- value: item.id,
- };
- });
- loadingSearch.value = false;
- });
- }
- return;
- };
- const clickCopy = () => {
- copyContract.value = true;
- };
- const selectPurchase = (businessId) => {
- if (businessId) {
- proxy.post("/ehsdPurchase/detail", { id: businessId }).then((res) => {
- res.purchaseProductList = res.ehsdPurchaseProductList || [];
- if (!res.fileList) {
- res.fileList = [];
- }
- res.countryId = res.sellCountryId;
- res.provinceId = res.sellProvinceId;
- res.cityId = res.sellCityId;
- for (let key in res) {
- if (
- ![
- "purchaseProductList",
- "ehsdPurchaseProductList",
- "purchaseArrivalList",
- ].includes(key)
- ) {
- formData.data[key] = res[key];
- }
- }
- remarkEditor.value.changeHtml(formData.data.remark);
- // 回显关联销售订单
- if (route.query && route.query.submitType === "10") {
- getAssociationData(
- formData.data.dataResource,
- formData.data.dataResourceId
- );
- }
- proxy
- .post("/fileInfo/getList", {
- businessIdList: [businessId],
- })
- .then((fileObj) => {
- if (fileObj[businessId]) {
- formData.data.fileList = fileObj[businessId]
- .filter((x) => x.businessType === "1")
- .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
- formData.data.packageFileList = fileObj[businessId]
- .filter((x) => x.businessType === "2")
- .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
- }
- });
- if (
- formData.data.purchaseProductList &&
- formData.data.purchaseProductList.length > 0
- ) {
- let ids = formData.data.purchaseProductList.map((x) => x.productId);
- getAuxiliaryData(formData.data.sellCorporationId, ids);
- proxy
- .post("/fileInfo/getList", {
- businessIdList: ids,
- })
- .then((fileObj) => {
- for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
- const e = formData.data.purchaseProductList[i];
- e.activeName = true;
- for (const key in fileObj) {
- if (e.productId === key) {
- e.fileList = fileObj[key] || [];
- if (e.fileList && e.fileList.length > 0) {
- e.fileUrl = e.fileList[0].fileUrl;
- }
- }
- }
- }
- });
- changeProductPrice();
- }
- if (formData.data.countryId) {
- getCityData(formData.data.countryId, "20");
- }
- if (formData.data.provinceId) {
- getCityData(formData.data.provinceId, "30");
- }
- });
- copyContract.value = false;
- ElMessage({
- message: "选择成功!",
- type: "success",
- });
- }
- };
- const optionTwo = reactive({
- data: {
- tooltip: {
- trigger: "axis",
- },
- // legend: {
- // data: ["价格"],
- // },
- grid: {
- left: "3%",
- right: "4%",
- top: "10%",
- bottom: "3%",
- containLabel: true,
- },
- // toolbox: {
- // feature: {
- // saveAsImage: {},
- // },
- // },
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: [],
- },
- yAxis: {
- type: "value",
- },
- series: [
- {
- name: "价格",
- type: "line",
- data: [],
- },
- ],
- },
- });
- const showEcharts = (row, index) => {
- let myChart = null;
- myChart = echarts.init(document.getElementById(row.productId + index));
- window.addEventListener("resize", () => {
- myChart.resize();
- });
- if (
- row.purchaseProductPriceListOne &&
- row.purchaseProductPriceListOne.length > 0
- ) {
- optionTwo.data.xAxis.data = row.purchaseProductPriceListOne.map((item) => {
- return item.createTime.slice(0, 10);
- });
- optionTwo.data.series[0].data = row.purchaseProductPriceListOne.map(
- (item) => {
- return item.price;
- }
- );
- } else {
- optionTwo.data.xAxis.data = [];
- optionTwo.data.series[0].data = [];
- }
- myChart.setOption(optionTwo.data);
- myChart.resize();
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep(.el-input-number .el-input__inner) {
- text-align: left;
- }
- .pic {
- object-fit: contain;
- width: 50px;
- height: 50px;
- cursor: pointer;
- vertical-align: middle;
- }
- .shrinkPadding {
- padding-right: 0 !important;
- }
- .hideCollapse {
- margin-top: -28px;
- border: 0 !important;
- }
- ::v-deep(.el-collapse-item__arrow) {
- display: none !important;
- }
- ::v-deep(.el-collapse-item__wrap) {
- border: 0 !important;
- }
- ::v-deep(.el-collapse-item__header) {
- border: 0 !important;
- }
- ::v-deep(.el-collapse-item__content) {
- padding-bottom: 8px !important;
- }
- .pic {
- object-fit: contain;
- width: 50px;
- height: 50px;
- cursor: pointer;
- vertical-align: middle;
- }
- ::v-deep(.removePadding) {
- .el-form-item {
- padding-right: 0 !important;
- }
- }
- .img {
- object-fit: contain;
- width: 16px;
- height: 16px;
- vertical-align: middle;
- }
- </style>
|