123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151 |
- <template>
- <div style="width: 100%; padding: 0px 15px">
- <byForm
- :formConfig="formConfig"
- :formOption="formOption"
- v-model="formData.data"
- :rules="rules"
- ref="submit"
- >
- <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"
- >
- <el-option
- v-for="item in supplierList"
- :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="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%; padding: 15px; border: 1px solid #eee"
- v-if="
- formData.data.purchaseProductList &&
- formData.data.purchaseProductList.length > 0
- "
- >
- <el-row
- style="
- margin-bottom: 15px;
- background: #eeeeee;
- font-weight: 700;
- padding: 10px;
- "
- >
- <el-col :span="14">货品信息</el-col>
- <el-col :span="4"
- >订单总数:{{ formData.data.purchaseProductList.length }}</el-col
- >
- <el-col :span="6">订单总金额:{{ getTotalAmount() }}</el-col>
- </el-row>
- <template
- v-for="(item, index) in formData.data.purchaseProductList"
- :key="index"
- >
- <div style="width: 100%">
- <el-table
- :data="item.purchaseProductMountingsList"
- :style="
- index !== formData.data.purchaseProductList.length - 1
- ? 'margin-bottom: 15px'
- : ''
- "
- >
- <!-- :span-method=" ({ rowIndex, columnIndex }) =>
- objectSpanMethod(rowIndex, columnIndex, item) " -->
- <el-table-column label="货品信息" align="left">
- <template #default="{ row }">
- <div style="display: flex; align-items: center">
- <div style="width: 50px; height: 50px">
- <img
- v-if="row.fileUrl"
- :src="row.fileUrl"
- class="pic"
- @click="onPicture(row.fileUrl)"
- />
- </div>
- <div style="margin-left: 20px">
- <div>{{ row.productName }}</div>
- <div style="display: flex; color: #999999">
- <span
- >类型:
- {{
- dictValueLabel(row.productType, productType)
- }}</span
- ><span style="margin-left: 20px"
- >尺寸:{{ row.productModel }}</span
- >
- </div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="数量"
- align="left"
- prop="quantity"
- width="180"
- >
- <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="单价"
- align="left"
- prop="price"
- width="180"
- >
- <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);
- }
- "
- >
- <el-input-number
- onmousewheel="return false;"
- v-model="row.price"
- placeholder="请输入单价"
- :precision="2"
- :controls="false"
- :min="0"
- />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="金额小计"
- align="left"
- width="140"
- prop="amount"
- />
- <el-table-column label="操作" align="center" width="100">
- <template #default="{ row, $index }">
- <div v-if="$index === 0">
- <div>
- <el-button
- type="primary"
- text
- @click="handleHandover(item, index)"
- >备注</el-button
- >
- </div>
- <div>
- <el-button
- type="primary"
- text
- @click="handleMaterial(index)"
- >添加配件</el-button
- >
- </div>
- </div>
- <div v-else>
- <el-button
- type="primary"
- link
- @click="handleRemove(index, $index)"
- >删除</el-button
- >
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </div>
- <!-- <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%"
- :gutter="5"
- type="flex"
- align="middle"
- >
- <el-col :span="2" style="text-align: center">
- <img
- v-if="item.fileUrl"
- :src="item.fileUrl"
- class="pic"
- @click="onPicture(item.fileUrl)"
- />
- </el-col>
- <el-col :span="5">
- <span>产品名称: {{ item.productName }}</span>
- </el-col>
- <el-col :span="4">
- <span>尺寸: {{ item.productModel }}</span>
- </el-col>
- <el-col :span="3">
- <span>数量: {{ item.quantity }}</span>
- </el-col>
- <el-col :span="3">
- <span>单价: {{ item.price }}</span>
- </el-col>
- <el-col :span="2">
- <el-button
- type="primary"
- text
- @click="handleHandover(item, index)"
- >编辑备注</el-button
- >
- </el-col>
- <el-col :span="2">
- <el-button type="primary" text @click="handleMaterial(index)"
- >添加配件</el-button
- >
- </el-col>
- <el-col :span="3">
- <span>金额小计: {{ item.amount }}</span>
- </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="140">
- <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);
- }
- "
- >
- <el-input-number
- onmousewheel="return false;"
- v-model="row.price"
- placeholder="请输入单价"
- :precision="2"
- :controls="false"
- :min="0"
- />
- </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"
- 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"
- :min="0"
- />
- </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
- v-else
- style="width: 100%"
- :value="formData.data.remark"
- @updateValue="updateContent"
- 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
- >
- <ProductMaterial
- :selectStatus="true"
- @selectMaterial="selectMaterial"
- ></ProductMaterial>
- </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="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
- :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="large">取 消</el-button>
- <el-button type="primary" @click="submitHandoverForm()" size="large"
- >确 定</el-button
- >
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import byForm from "@/components/byForm/index";
- import ProductMaterial from "@/views/product/material/index";
- import { ElMessage } from "element-plus";
- import selectCity from "@/components/selectCity/index.vue";
- import Editor from "@/components/Editor/index.vue";
- import { useRoute } from "vue-router";
- 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 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: "buyer",
- label: "买方信息",
- itemWidth: 50,
- },
- {
- type: "slot",
- slotName: "seller",
- label: "卖方信息",
- itemWidth: 50,
- },
- {
- type: "slot",
- slotName: "payment",
- label: "付款信息",
- },
- {
- type: "slot",
- slotName: "delivery",
- label: "交付信息",
- },
- {
- type: "slot",
- slotName: "commodity",
- label: "采购明细",
- },
- {
- type: "slot",
- slotName: "otherCharge",
- label: "其他收费项目",
- },
- {
- type: "slot",
- slotName: "offerMoney",
- },
- {
- type: "slot",
- slotName: "contractClause",
- label: "合同条款",
- },
- {
- 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 changeSupplier = (val) => {
- 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 (
- 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,
- });
- watch(
- props.queryData,
- () => {
- formOption.disabled = judgeStatus();
- return;
- if (
- props.queryData &&
- ["10", "20", "30"].includes(route.query.processType)
- ) {
- for (var text in props.queryData) {
- formData.data[text] = props.queryData[text];
- }
- if (formData.data.countryId) {
- getCityData(formData.data.countryId, "20");
- }
- if (formData.data.provinceId) {
- getCityData(formData.data.provinceId, "30");
- }
- const ids = formData.data.purchaseProductList.map((x) => x.productId);
- if (formData.data.sellCorporationId && ids.length > 0) {
- getAuxiliaryData(formData.data.sellCorporationId, ids);
- }
- }
- },
- {
- deep: true,
- }
- );
- const getFormData = () => {
- return proxy.deepClone(formData.data);
- };
- // 向父组件暴露
- defineExpose({
- getFormData,
- handleSubmit,
- });
- onMounted(() => {
- if (props.queryData.ids) {
- proxy.post("/delivery/page", { ids: props.queryData.ids }).then((res) => {
- formData.data.dataResource = props.queryData.type;
- 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,
- 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,
- price: undefined,
- amount: "",
- remark: "",
- json: "",
- fileUrl: "",
- activeName: false,
- },
- ],
- 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;
- }
- }
- });
- } 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) => {
- 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];
- }
- 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);
- proxy
- .post("/fileInfo/getList", {
- businessIdList: ids,
- })
- .then((fileObj) => {
- for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
- const e = formData.data.purchaseProductList[i];
- 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;
- }
- }
- }
- }
- });
- }
- 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;
- 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: false,
- });
- 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: [],
- },
- ]);
- const auxiliaryChange = (data) => {
- emit("auxiliaryChange", data);
- };
- const getAuxiliaryData = (supplyId, productIdList) => {
- if (supplyId && productIdList.length > 0) {
- proxy
- .post("/subscribe/decisionAid", {
- supplyId: supplyId,
- productIdList: productIdList,
- })
- .then((res) => {
- // 获取数组长度
- let dataLength = auxiliaryData.value.length;
- // 供应商最近采购
- const recentlyArr = [
- {
- label: "合同编号",
- value: "",
- fn: () => {},
- num: 1,
- },
- {
- label: "下单日期",
- value: "",
- num: 1,
- },
- {
- label: "合同金额",
- value: "",
- num: 1,
- },
- ];
- auxiliaryData.value[dataLength - 2].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[dataLength - 1].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 {
- if (props.queryData.type === "handoverSlip" && props.queryData.arr) {
- let arrConfig = [
- {
- label: "合同编号",
- value: "",
- fn: () => {},
- 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 objectSpanMethod = (rowIndex, columnIndex, item) => {
- if (columnIndex === 3) {
- if (rowIndex === 0) {
- return {
- rowspan: item.purchaseProductMountingsList.length,
- colspan: 1,
- };
- } else {
- return {
- rowspan: 0,
- colspan: 1,
- };
- }
- }
- };
- const getTotalAmount = () => {
- const total = formData.data.purchaseProjectList.reduce(
- (val, x) => (val += Number(x.amount)),
- 0
- );
- if (total) {
- return parseFloat(formData.data.amount - total).toFixed(2);
- } else {
- if (formData.data.amount) {
- return parseFloat(formData.data.amount).toFixed(2);
- }
- }
- };
- </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;
- }
- }
- </style>
|