12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066 |
- <template>
- <div style="width: 100%; padding: 0px 15px">
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom">
- <template #btn>
- <div>
- <el-button type="primary" v-if="
- [30].includes(route.query.processType) || !route.query.processType
- " @click="clickCopy(1)">复制合同</el-button>
- </div>
- </template>
- <template #ofCompanyId>
- <div style="width: 100%">
- <el-form-item label="业务公司" class="margin-b-0 wid100" required>
- <el-row style="width: 100%">
- <el-col :span="12">
- <el-form-item prop="ofCompanyId" label="" label-width="0px" class="margin-b-0 wid100">
- <el-tree-select v-model="formData.data.ofCompanyId" :data="useUserStore().allDict['tree_company_data']" style="width: 100%"
- placeholder="公司" default-expand-all
- :props="{ value: 'deptId', label: 'deptName', children: 'children', disabled: 'disabled' }"
- @change="handleOfCompanyIdChange" :disabled="useUserStore().currentCompany==useUserStore().user.ofCompanyId" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item prop="deptId" label="" label-width="0px" class="margin-b-0 wid100">
- <el-tree-select v-model="formData.data.deptId" :data="deptData" style="width: 100%" placeholder="部门" default-expand-all
- :props="{ value: 'deptId', label: 'deptName', children: 'children', disabled: 'disabled' }"
- :disabled="useUserStore().currentCompany==useUserStore().user.ofCompanyId" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form-item>
- </div>
- </template>
- <template #seller>
- <div style="width: 100%">
- <el-form-item prop="sellCorporationId" label="卖方信息" class="wid100">
- <el-select v-model="formData.data.sellCorporationId" placeholder="请选择卖方公司" style="width: 100%" @change="sellCorporationIdChange"
- filterable>
- <el-option v-for="item in corporationList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-form-item label="地址" class="wid100">
- <el-row style="width:100%">
- <el-col :span="8">
- <el-form-item label="" prop="sellCountryName" label-width="0px" class="margin-b-0 wid100">
- <el-input v-model="formData.data.sellCountryName" placeholder="请输入国家" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="" prop="sellProvinceName" label-width="0px" class="margin-b-0 wid100">
- <el-input v-model="formData.data.sellProvinceName" placeholder="请输入省/州" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="" prop="sellCityName" label-width="0px" class="margin-b-0 wid100">
- <el-input v-model="formData.data.sellCityName" placeholder="请输入城市" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form-item>
- <el-form-item label="详细地址" prop="sellAddress" class="wid100">
- <el-input v-model="formData.data.sellAddress" type="textarea">
- </el-input>
- </el-form-item>
- <el-form-item label="联系人" class="wid100">
- <el-row style="width:100%">
- <el-col :span="8">
- <el-form-item label="" prop="sellContactName" label-width="0px" class="margin-b-0 wid100">
- <el-input v-model="formData.data.sellContactName" placeholder="请输入联系人" />
- </el-form-item>
- </el-col>
- <el-col :span="16">
- <el-form-item label="" prop="sellContactNumber" label-width="0px" class="margin-b-0 wid100">
- <el-input v-model="formData.data.sellContactNumber" placeholder="请输入联系人电话" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form-item>
- </div>
- </template>
- <template #buyer>
- <div style="width: 100%">
- <el-form-item label="买方信息" prop="buyCorporationId" class="wid100">
- <el-select v-model="formData.data.buyCorporationId" filterable remote reserve-keyword placeholder="请输入关键字" remote-show-suffix
- :remote-method="remoteMethod" :loading="loadingSearch" @input="remoteMethod" style="width: 100%" @change="changeCustomer" v-if="
- [30].includes(route.query.processType) ||
- !route.query.processType
- " :disabled="!isEditList">
- <el-option v-for="item in customerList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- <el-select v-model="formData.data.buyCorporationName" disabled v-else style="width: 100%">
- </el-select>
- </el-form-item>
- <el-form-item label="地址" class="wid100" required>
- <el-row style="width: 100%">
- <el-col :span="6">
- <el-form-item label="" prop="countryId" class="margin-b-0">
- <el-select v-model="formData.data.countryId" placeholder="国家" style="width:100%" filterable
- @change="(val) => getCityData(val, '20', true)" :disabled="!isEditList">
- <el-option v-for="item in countryData" :label="item.name" :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="" prop="provinceName" class="margin-b-0">
- <selectCity placeholder="省/洲" @change="(val) => getCityData(val, '30', true)" addressId="provinceId" addressName="provinceName"
- v-model="formData.data" :data="provinceData" :disabled="!isEditList">
- </selectCity>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="" prop="cityName" class="margin-b-0">
- <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="formData.data" :data="cityData"
- :disabled="!isEditList">
- </selectCity>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="" prop="buyPostalCode" class="margin-b-0">
- <el-input v-model="formData.data.buyPostalCode" placeholder="请输入邮编" :disabled="!isEditList" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form-item>
- <el-form-item label="详细地址" prop="buyAddress" class="wid100">
- <el-input v-model="formData.data.buyAddress" type="textarea" :disabled="!isEditList">
- </el-input>
- </el-form-item>
- <el-form-item label="联系人" class="wid100" required>
- <el-row style="width: 100%">
- <el-col :span="8">
- <el-form-item label="" prop="buyContactName" label-width="0px" class="margin-b-0 wid100">
- <el-autocomplete v-model="formData.data.buyContactName" :fetch-suggestions="querySearchPerson" style="width:100%" clearable
- class="inline-input w-50" placeholder="请输入联系人" @select="handlePerson" :disabled="!isEditList">
- </el-autocomplete>
- </el-form-item>
- </el-col>
- <el-col :span="16">
- <el-form-item label="" prop="buyContactNumber" label-width="0px" class="margin-b-0 wid100">
- <el-input v-model="formData.data.buyContactNumber" placeholder="请输入联系人电话" :disabled="!isEditList" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form-item>
- </div>
- </template>
- <template #commodity>
- <div style="width: 100%">
- <el-button type="primary" @click="openProductCompany = true" plain style="margin-bottom: 16px" v-if="!judgeStatus() && isEditList"
- :disabled="!formData.data.companyId">产品库</el-button>
-
- <el-table :data="formData.data.contractProductList" style="width: 100%;" row-key="rowId">
- <el-table-column type="expand" width="50" align="center">
- <template #default="scope">
- <div style="padding-left:50px">
- <div style="margin-bottom:10px;">
- <TitleInfo content='BOM单:'></TitleInfo>
- </div>
- <el-table :data="scope.row.contractProductBomList" style="width: 100%;" border class="bom-table" row-key="materialId">
- <el-table-column label="图片" width="80">
- <template #default="{ row }">
- <div v-if="row.fileUrl">
- <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
- </div>
- <div v-else></div>
- </template>
- </el-table-column>
- <el-table-column prop="productCode" label="物料编码" width="190" />
- <el-table-column prop="productName" label="物料名称" min-width="200" />
- <el-table-column label="尺寸 (cm)" width="130">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="quantity" label="数量" width="130">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item v-if="isEditList"
- :prop="'contractProductList.' + scope.$index + '.contractProductBomList.' + $index + '.quantity'"
- :rules="rules.quantity" :inline-message="true" class="margin-b-0 wid100">
- <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%" :precision="0"
- :controls="false" :min="1" />
- </el-form-item>
- <span v-else>{{row.quantity}}</span>
- </div>
- </template>
- </el-table-column>
-
-
- {{row.price}}
-
- {{row.amount}}
- <el-table-column prop="remark" label="备注" width="180">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item v-if="isEditList" :inline-message="true" class="margin-b-0 wid100">
- <el-input v-model="row.remark" placeholder="请输入" style="width: 100%" />
- </el-form-item>
- <span v-else>{{row.remark}}</span>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="60" align="center" fixed="right" v-if="!judgeStatus() && isEditList">
- <template #default="{ row,$index }">
- <el-button type="primary" link @click="handleDeleteMaterial(scope.$index,$index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="商品图片" width="80">
- <template #default="{ row }">
- <div v-if="row.fileUrl">
- <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
- </div>
- <div v-else></div>
- </template>
- </el-table-column>
- <el-table-column prop="productCnName" label="商品名称" min-width="130" />
- <el-table-column prop="productCode" label="商品编码" width="150" />
- <el-table-column label="尺寸 (cm)" width="130">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="productColor" label="颜色" width="140" />
-
- <el-table-column label="生产plt文件" width="210">
- <template #default="{ row, $index }">
- <div style="width:100%">
- <div style="display:flex">
- <div style="writing-mode: vertical-rl;margin-right:10px;background:rgb(94 120 145);color:#fff;padding:5px 2px;border-radius:3px;line-height:21px;;cursor:pointer"
- @click="handleClickUploadOne($index)" v-if="!judgeStatus()">
- {{row.isShowProductFile?'上 传 文 件':'取 消 上 传'}}
- </div>
- <div>
- <div v-if="row.isShowProductFile &&row.fileListOne && row.fileListOne.length > 0">
- <span class="el-click" @click="onPicture(row.fileListOne[0].fileUrl)">{{row.fileListOne[0].fileName}}</span>
- </div>
- <div v-else>
- <el-upload :file-list="row.prodFileList" :action="uploadUrl" :data="uploadData" :limit="1" :list-type="'text'"
- :before-upload="(file)=>handleBeforeUploadOne(file,$index)" :on-success="()=>handleSuccessOne($index)"
- :on-remove="(file)=>handleRemoveFile(file,$index)" :on-preview="onPreviewFile"
- :on-exceed="()=>msgTip(`上传文件数量不可大于1`, 2)">
- <el-button text type="primary">上传</el-button>
- </el-upload>
- </div>
- </div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="数量" width="110">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true"
- class="margin-b-0 wid100">
- <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%" :precision="0"
- :controls="false" :min="0" @change="calculationAmount('quantity')" v-if="isEditList" />
- <div v-else> {{row.quantity}}</div>
- </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="'contractProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true"
- class="margin-b-0 wid100">
- <div style="display:flex;">
- <el-input-number onmousewheel="return false;" v-model="row.price" placeholder="请输入" style="width: 100%" :precision="2"
- :controls="false" :min="0" @change="calculationAmount()" v-if="isEditList" />
- <div v-else>¥ {{row.price}}</div>
- <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">
- {{row.currency}} {{moneyFormat(row.salePrice,2)}}
- </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 in row.customerContractProductList">
- <span>{{item.createTime.slice(0,10)}} </span>
- <span style="margin-left:40px">{{item.code}} </span>
- <span style="margin-left:40px"> {{item.currency}} {{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 in row.contractProductList">
- <span>{{item.createTime.slice(0,10)}} </span>
- <span style="margin-left:40px">{{item.code}} </span>
- <span style="margin-left:40px">{{item.currency}} {{moneyFormat(item.price,2)}} </span>
- </div>
- </div>
- </div>
- <div :ref="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 prop="amount" label="小计" width="110">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- ¥ {{row.amount}}
- </div>
- </template>
- </el-table-column>
- <el-table-column label="备注" min-width="200">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProductList.' + $index + '.remark'" :inline-message="true" class="margin-b-0 wid100">
- <el-input v-model="row.remark" placeholder="请输入" style="width: 100%" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="140" align="center" fixed="right" v-if="!judgeStatus() && isEditList">
- <template #default="{ $index }">
- <el-button type="primary" link @click="handleClickSelectMaterial($index)">包材/配件/辅材</el-button>
- <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #otherCharge>
- <div style="width: 100%">
- <el-button type="primary" @click="clickAdd()" plain style="margin-bottom: 16px" v-if="!judgeStatus()">添加行</el-button>
- <el-table :data="formData.data.contractProjectList" style="width: 100%;">
- <el-table-column label="收费项目" width="220">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProjectList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true"
- class="margin-b-0 wid100">
- <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="'金额'" width="130">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProjectList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true"
- class="margin-b-0 wid100">
- <el-input-number onmousewheel="return false;" v-model="row.amount" placeholder="请输入金额" style="width: 100%" :precision="2"
- :controls="false" :min="0" @change="totalAmount()" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="备注">
- <template #default="{ row, $index }">
- <div style="width: 100%">
- <el-form-item :prop="'contractProjectList.' + $index + '.remark'" class="margin-b-0 wid100">
- <el-input v-model="row.remark" placeholder="请输入备注" />
- </el-form-item>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="60" align="center" fixed="right" v-if="!judgeStatus()">
- <template #default="{ $index }">
- <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #templateContent>
- <div style="width: 100%">
- <Editor :value="formData.data.templateContent" @updateValue="updateContent" :readOnly="judgeStatus()" ref="remarkEditor" />
- </div>
- </template>
- </byForm>
- <el-dialog v-if="openProductCompany" v-model="openProductCompany" title="产品库" width="90%" append-to-body>
- <SelectProduct @selectProduct="selectProduct" :companyId="formData.data.companyId" :isRawMaterial="'1'" :disablePerm="'1'"></SelectProduct>
- <template #footer>
- <el-button @click="openProductCompany = false" size="defualt" v-debounce>关 闭</el-button>
- </template>
- </el-dialog>
- <el-dialog :title="'物料选择'" v-model="openSelectMaterial" width="90%" destroy-on-close>
- <SelectMaterial :isNeRawMaterial="'1'" @selectMaterial="selectMaterial"></SelectMaterial>
- <template #footer>
- <el-button @click="openSelectMaterial = false" size="defualt" v-debounce>关 闭</el-button>
- </template>
- </el-dialog>
-
- </div>
- </template>
- <script setup>
- import byForm from "@/components/byForm/index";
- import SelectProduct from "@/components/product/SelectProduct.vue";
- import SelectMaterial from "@/components/product/SelectMaterial.vue";
- import Editor from "@/components/Editor/index.vue";
- import selectCity from "@/components/selectCity/index.vue";
- import { useRoute } from "vue-router";
- import SelectContract from "@/components/contractCom/selectContract.vue";
- import SelectSample from "@/components/contractCom/selectSample.vue";
- import * as echarts from "echarts";
- import $bus from "@/bus/index.js";
- import { v4 as uuidv4 } from "uuid";
- import { async } from "@antv/x6/lib/registry/marker/main";
- const route = useRoute();
- const { proxy } = getCurrentInstance();
- const props = defineProps({
- queryData: Object,
- });
- const currencyData = computed(
- () => proxy.useUserStore().allDict["account_currency"]
- );
- const fundsPaymentMethod = computed(
- () => proxy.useUserStore().allDict["funds_payment_method"]
- );
- const shippingMethod = computed(
- () => proxy.useUserStore().allDict["shipping_method"]
- );
- const companyId = computed(() => proxy.useUserStore().user.companyId);
- const accountList = ref([]);
- const customerList = ref([]);
- const templateList = ref([]);
- const userList = ref([]);
- const corporationList = ref([]);
- const customerUserList = ref([]);
- const countryData = ref([]);
- const provinceData = ref([]);
- const cityData = ref([]);
- const treeData = ref([]);
- const deptData = ref([]);
- const openProductCompany = ref(false);
- const copyType = ref(1);
- const copyContract = ref(false);
- const indexValue = ref(-1);
- const openSelectMaterial = ref(false);
- const formData = reactive({
- data: {
- contractType: "2",
- rate: 1,
- contractProductList: [],
- companyId: "",
- templateContent: "",
- },
- });
- const uploadData = ref({});
- const formDom = ref(null);
- const remarkEditor = ref(null);
- const judgeStatus = () => {
- if (
- route.query.processType == 20 ||
- route.query.processType == 10 ||
- props.queryData.processType == 20 ||
- props.queryData.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: 120,
- itemWidth: 100,
- disabled: false,
- });
- const formConfig = computed(() => {
- return [
-
-
-
-
-
-
- {
- type: "title",
- title: "基本信息",
- },
- {
- type: "input",
- prop: "code",
- label: "合同号",
- disabled: true,
- isShow: formData.data.code ? true : false,
- },
-
-
-
-
-
-
-
-
-
- {
- type: "slot",
- slotName: "ofCompanyId",
- label: "",
- itemWidth: 50,
- },
- {
- type: "select",
- prop: "contractType",
- label: "订单类型",
- data: [
- {
- dictKey: "3",
- dictValue: "打样订单",
- },
- {
- dictKey: "2",
- dictValue: "内销订单",
- },
- {
- dictKey: "1",
- dictValue: "外贸订单(退税)",
- },
- {
- dictKey: "4",
- dictValue: "外贸订单(不退税)",
- },
- ],
- itemWidth: 50,
- fn: (val) => {
- if (val == "2") {
- formData.data.currency = currencyData.value[0].dictKey;
- formData.data.rate = 1;
- }
- if (formData.data.sellCorporationId) {
- sellCorporationIdChange(formData.data.sellCorporationId);
- }
- if (formData.data.shroffAccountId) {
- changeShroffAccount(formData.data.shroffAccountId);
- }
- },
- },
- {
- type: "treeSelect",
- prop: "companyId",
- label: "工厂",
- data: treeData.value,
- propsTreeLabel: "deptName",
- propsTreeValue: "deptId",
- itemWidth: 50,
- disabled: !isEditList.value,
- fn: () => {
- formData.data.contractProductList = [];
- },
- },
- {
- type: "select",
- prop: "belongType",
- label: "订单归属",
- data: [
- {
- dictKey: "1",
- dictValue: "归属工厂",
- },
- {
- dictKey: "2",
- dictValue: "归属业务",
- },
- ],
- itemWidth: 50,
- },
- {
- type: "select",
- prop: "merchUserId",
- label: "跟单员",
- data: userList.value,
- itemWidth: 50,
- },
- {
- type: "title",
- title: "贸易信息",
- haveLine: true,
- },
- {
- type: "slot",
- slotName: "seller",
- label: "",
- itemWidth: 50,
- },
- {
- type: "slot",
- slotName: "buyer",
- label: "",
- itemWidth: 50,
- },
- {
- type: "title",
- title: "付款信息",
- haveLine: true,
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- type: "select",
- prop: "isTax",
- label: "是否含税",
- data: [
- {
- dictKey: "1",
- dictValue: "含税",
- },
- {
- dictKey: "0",
- dictValue: "不含税",
- },
- ],
- itemWidth: 25,
- },
- {
- type: "select",
- prop: "isFreight",
- label: "是否含运费",
- data: [
- {
- dictKey: "1",
- dictValue: "含运费",
- },
- {
- dictKey: "0",
- dictValue: "不含运费",
- },
- ],
- itemWidth: 25,
- },
- {
- type: "select",
- prop: "paymentMethod",
- label: "付款方式",
- data: fundsPaymentMethod.value,
- itemWidth: 25,
- },
- {
- type: "number",
- prop: "advanceRatio",
- label: "预付款比列(%)",
- precision: 2,
- min: 0,
- controls: false,
- itemWidth: 25,
- },
- {
- type: "input",
- prop: "remark",
- label: "付款条件",
- itemType: "textarea",
- itemWidth: 100,
- },
- {
- type: "select",
- prop: "shroffAccountId",
- label: "收款账号",
- data: accountList.value,
- itemWidth: 50,
- fn: (val) => {
- changeShroffAccount(val);
- },
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- type: "input",
- prop: "accountName",
- label: "户名",
- placeholder: "请输入户名",
- itemWidth: 50,
-
- },
- {
- type: "input",
- prop: "openingBank",
- label: "开户行",
- placeholder: "请输入开户行",
- itemWidth: 50,
-
- },
- {
- type: "input",
- prop: "accountOpening",
- label: "账号",
- placeholder: "请输入账号",
- itemWidth: 50,
-
- },
-
-
-
-
-
- {
- type: "title",
- title: "交付信息",
- haveLine: true,
- },
- {
- type: "date",
- prop: "deliveryTime",
- label: "交货期限",
- itemWidth: 50,
- },
- {
- type: "select",
- prop: "transportMethod",
- label: "运输方式",
- data: shippingMethod.value,
- itemWidth: 50,
- },
-
-
-
-
-
-
-
-
-
-
-
- {
- type: "title",
- title: "商品信息",
- haveLine: true,
- },
- {
- type: "slot",
- slotName: "commodity",
- label: "",
- },
- {
- type: "title",
- title: "其他收费项目",
- haveLine: true,
- },
- {
- type: "slot",
- slotName: "otherCharge",
- label: "",
- },
- {
- type: "title",
- title: "合同总金额",
- haveLine: true,
- },
- {
- type: "input",
- prop: "amount",
- label: "合同总金额",
- itemWidth: 25,
- disabled: true,
- },
- {
- type: "title",
- title: "合同模板",
- haveLine: true,
- },
- {
- type: "select",
- prop: "contractTemplateId",
- label: "合同模板",
- data: templateList.value,
- itemWidth: 50,
- fn: (val) => {
- proxy.post("/contractTemplate/detail", { id: val }).then((res) => {
- formData.data.templateContent = res.templateContent;
- remarkEditor.value.changeHtml(formData.data.templateContent);
- });
- },
- },
- {
- type: "slot",
- slotName: "templateContent",
- prop: "templateContent",
- label: "模板内容",
- itemWidth: 100,
- disabled: false,
- },
- ];
- });
- const rules = ref({
- ofCompanyId: [
- { required: true, message: "请选择业务公司", trigger: "change" },
- ],
- deptId: [{ required: true, message: "请选择业务部门", trigger: "change" }],
- companyId: [{ required: true, message: "请选择生产公司", trigger: "change" }],
- contractType: [
- { required: true, message: "请选择订单类型", trigger: "change" },
- ],
- deliveryTime: [
- { required: true, message: "请选择交货日期", trigger: "change" },
- ],
- belongType: [
- { required: true, message: "请选择订单归属", trigger: "change" },
- ],
- merchUserId: [{ required: true, message: "请选择跟单员", trigger: "change" }],
- isTax: [{ required: true, message: "请选择是否含税", trigger: "change" }],
- isFreight: [
- { required: true, message: "请选择是否含运费", trigger: "change" },
- ],
- sellCorporationId: [
- { required: true, message: "请选择卖方公司", trigger: "change" },
- ],
- buyCorporationId: [
- { required: true, message: "请选择买方公司", trigger: "change" },
- ],
- countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
- sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
- buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
- buyContactName: [
- { required: true, message: "请输入联系人", trigger: ["change", "blur"] },
- ],
- buyContactNumber: [
- { required: true, message: "请输入联系电话", trigger: "blur" },
- ],
- quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
- price: [{ required: true, message: "请输入单价", trigger: "blur" }],
- payName: [
- { required: true, message: "请输入收费项目", trigger: ["change", "blur"] },
- ],
- currency: [{ required: true, message: "请选择币种", trigger: "change" }],
- paymentMethod: [
- { required: true, message: "请选择付款方式", trigger: "change" },
- ],
- advanceRatio: [
- { required: true, message: "请输入预付比例", trigger: "blur" },
- ],
- transportMethod: [
- { required: true, message: "请选择运输方式", trigger: "change" },
- ],
-
- rate: [{ required: true, message: "请输入汇率", trigger: "blur" }],
- shroffAccountId: [
- { required: true, message: "请选择收款账号", trigger: "change" },
- ],
-
-
-
- templateContent: [
- { required: true, message: "请输入模板内容", trigger: "blur" },
- ],
- });
- const getDict = () => {
- proxy
- .post("/contractTemplate/page", {
- pageNum: 1,
- pageSize: 999,
- templateType: "1",
- })
- .then((res) => {
- templateList.value = res.rows.map((x) => ({
- label: x.templateName,
- value: x.id,
- }));
- });
- proxy
- .post("/customer/selPage", {
- pageNum: 1,
- pageSize: 50,
- })
- .then((res) => {
- customerList.value = res.rows.map((x) => ({
- ...x,
- label: x.name,
- value: x.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("/accountManagement/page", { pageNum: 1, pageSize: 999 })
- .then((res) => {
- accountList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.alias,
- value: item.id,
- };
- });
- });
- proxy
- .get("/tenantDept/list", {
- pageNum: 1,
- pageSize: 9999,
- keyword: "",
- tenantId: proxy.useUserStore().user.tenantId,
- type: 0,
- })
- .then((res) => {
- treeData.value = proxy.handleTree(res.data, "deptId");
- });
- proxy
- .get("/tenantUser/list", {
- pageNum: 1,
- pageSize: 10000,
- tenantId: proxy.useUserStore().user.tenantId,
-
- })
- .then((res) => {
- userList.value = res.rows.map((item) => {
- return {
- label: item.nickName,
- value: item.userId,
- };
- });
- });
- };
- const getCityData = (id, type, isChange) => {
- 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;
- }
- });
- };
- getDict();
- getCityData("0");
- const handleOfCompanyIdChange = (val) => {
- if (val) {
- proxy
- .get("/tenantDept/list", {
- pageNum: 1,
- pageSize: 9999,
- keyword: "",
- ancestors: val,
- tenantId: proxy.useUserStore().user.tenantId,
-
- })
- .then((res) => {
- deptData.value = proxy.handleTree(res.data, "deptId");
- });
- }
- };
- const sellCorporationIdChange = (val) => {
- if (val) {
- proxy.post("/corporation/detail", { id: val }).then((res) => {
- formData.data.sellCountryName = res.countryName;
- formData.data.sellProvinceName = res.provinceName;
- formData.data.sellCityName = res.cityName;
- formData.data.sellAddress = res.address;
- formData.data.sellContactName = res.contactName;
- formData.data.sellContactNumber = res.contactPhone;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- });
- }
- };
- const changeCustomer = (val) => {
- formData.data.contractProductList = [];
- if (val) {
- proxy.post("/customer/detail", { id: val }).then(
- (res) => {
- formData.data.buyCorporationName = res.name;
- if (res.customerUserList && res.customerUserList.length > 0) {
- formData.data.buyContactName = res.customerUserList[0].name;
- if (res.customerUserList[0].contactJson) {
- let contactJson = JSON.parse(res.customerUserList[0].contactJson);
- if (contactJson && contactJson.length > 0) {
- formData.data.buyContactNumber = contactJson[0].contactNo;
- }
- }
- customerUserList.value = res.customerUserList.map((item) => {
- return {
- ...item,
- value: item.name,
- };
- });
- }
-
-
-
-
-
-
-
- formData.data.countryId = res.countryId;
- formData.data.provinceId = res.provinceId;
- formData.data.cityId = res.cityId;
- formData.data.buyPostalCode = res.zipCode;
- formData.data.buyAddress = res.address;
- getCityData(formData.data.countryId, "20");
- if (formData.data.provinceId) {
- getCityData(formData.data.provinceId, "30");
- }
- },
- (err) => {
- formData.data.countryId = "";
- formData.data.provinceId = "";
- formData.data.cityId = "";
- formData.data.buyPostalCode = "";
- formData.data.buyAddress = "";
- }
- );
- } else {
- formData.data.countryId = "";
- formData.data.provinceId = "";
- formData.data.cityId = "";
- formData.data.buyPostalCode = "";
- formData.data.buyAddress = "";
- }
- };
- const createFilter = (queryString) => {
- return (restaurant) => {
- return (
- restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
- );
- };
- };
- const querySearchPerson = (queryString, callback) => {
- const results = queryString
- ? customerUserList.value.filter(createFilter(queryString))
- : customerUserList.value;
- callback(results);
- };
- const handlePerson = (item) => {
- if (item.contactJson) {
- let data = JSON.parse(item.contactJson);
- formData.data.buyContactNumber = data[0].contactNo;
- }
- };
- const handleClickSelectMaterial = (index) => {
- indexValue.value = index;
- openSelectMaterial.value = true;
- };
- const contractProductBomList = ref([]);
- const selectProduct = async (goods) => {
- if (goods && goods.id) {
- let rowId = uuidv4();
- let allFile = [];
- let fileUrl = "";
- if (goods.fileList && goods.fileList.length > 0) {
- fileUrl = goods.fileList[0].fileUrl;
- }
- const fileData = await proxy.post("/fileInfo/getList", {
- businessIdList: [goods.id],
- });
- if (fileData[goods.id] && fileData[goods.id].length > 0) {
- allFile = fileData[goods.id];
- } else {
- allFile = [];
- }
- proxy.post("/productBomInfo/detail", { id: goods.id }).then((res) => {
- if (res.productBomDetailList && res.productBomDetailList.length > 0) {
- contractProductBomList.value = res.productBomDetailList.map((x) => ({
- fileUrl: "",
- materialId: x.materialId,
- productName: x.materialName,
- productCode: x.materialCode,
- productLength: x.materialLength,
- productWidth: x.materialWidth,
- productHeight: x.materialHeight,
- quantity: x.quantity || null,
- allQuantity: "",
- price: x.materialPrice || null,
- amount: "",
- fileList: [],
- type: x.type,
- }));
- let fileListOne = [];
- if (allFile && allFile.length > 0) {
- fileListOne = allFile.filter((x) => x.businessType == "2");
- }
- formData.data.contractProductList.push({
- fileUrl: fileUrl,
- productId: goods.id,
- productCnName: goods.name,
- productCode: goods.customCode,
- productLength: goods["length"],
- productWidth: goods.width,
- productHeight: goods.height,
- productColor: goods.color,
- prodFilePath: goods.prodFilePath,
- quantity: null,
- price: goods.price || null,
- amount: "",
- remark: "",
- fileList: [],
- isShowProductFile: true,
- fileListOne: fileListOne,
- prodFileList: [],
- contractProductBomList: contractProductBomList.value,
- rowId: rowId,
- });
- proxy.msgTip("添加成功", 1);
- changeProductPrice();
- let ids = contractProductBomList.value.map((x) => x.materialId);
- proxy.getFile(
- ids,
- contractProductBomList.value,
- "materialId",
- "fileList",
- "fileUrl"
- );
- } else {
- return proxy.msgTip("该产品未配置BOM", 2);
- }
- });
- } else {
- return proxy.msgTip("选择错误", 2);
- }
- };
- const selectMaterial = (goods) => {
- let flag = formData.data.contractProductList[
- indexValue.value
- ].contractProductBomList.some((x) => x.materialId == goods.id);
- if (!flag) {
- let fileUrl = "";
- if (goods.fileList && goods.fileList.length > 0) {
- fileUrl = goods.fileList[0].fileUrl;
- }
- formData.data.contractProductList[
- indexValue.value
- ].contractProductBomList.push({
- fileUrl: fileUrl,
- materialId: goods.id,
- productName: goods.name,
- productCode: goods.customCode,
- productLength: goods["length"],
- productWidth: goods.width,
- productHeight: goods.height,
- quantity: null,
- price: goods.price || null,
- amount: "",
- fileList: [],
- type: 2,
- });
- proxy.msgTip("选择成功");
- } else {
- proxy.msgTip("该物料已选择", 2);
- }
- };
- const changeProductPrice = () => {
- let productIds = formData.data.contractProductList.map((x) => x.productId);
- if (productIds && productIds.length > 0) {
- proxy
- .post("/contract/getProductPriceInfo", {
- productIds: productIds,
- customerId: formData.data.buyCorporationId
- ? formData.data.buyCorporationId
- : "",
- })
- .then((res) => {
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- const iele = formData.data.contractProductList[i];
- for (const key in res) {
- if (key == iele.productId) {
- iele.salePrice = res[key].price;
- iele.currency = res[key].currency;
- iele.saleCostPrice = res[key].costPrice;
- iele.contractProductList = res[key].contractProductList
- .map((x) => ({
- createTime: x.createTime || "",
- price: x.price,
- currency: x.currency,
- }))
- .filter((y, index) => index < 3);
- iele.contractProductListOne = res[key].contractProductList.map(
- (x) => ({
- createTime: x.createTime || "",
- price: x.price,
- currency: x.currency,
- })
- );
- iele.customerContractProductList = res[
- key
- ].customerContractProductList.map((x) => ({
- createTime: x.createTime || "",
- price: x.price,
- currency: x.currency,
- }));
- }
- }
- }
- });
- }
- };
- const updateContent = (val) => {
- formData.data.templateContent = val;
- };
- const onPicture = (path) => {
- window.open(path, "_blank");
- };
- const handleRemove = (index) => {
- formData.data.contractProductList.splice(index, 1);
- totalAmount();
- };
- const handleDeleteMaterial = (index, sonIndex) => {
- formData.data.contractProductList[index].contractProductBomList.splice(
- sonIndex,
- 1
- );
- };
- const calculationAmount = (att = "") => {
- nextTick(() => {
- if (
- formData.data.contractProductList &&
- formData.data.contractProductList.length > 0
- ) {
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- let money = 0;
- money = parseFloat(
- Number(formData.data.contractProductList[i].quantity) *
- Number(formData.data.contractProductList[i].price)
- ).toFixed(2);
- formData.data.contractProductList[i].amount = money;
- }
- }
- nextTick(() => {
- totalAmount();
- });
- });
- };
- const totalAmount = () => {
- let money = 0;
- if (
- formData.data.contractProductList &&
- formData.data.contractProductList.length > 0
- ) {
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- if (formData.data.contractProductList[i].amount) {
- money = parseFloat(
- Number(money) + Number(formData.data.contractProductList[i].amount)
- ).toFixed(2);
- }
- }
- }
- if (
- formData.data.contractProjectList &&
- formData.data.contractProjectList.length > 0
- ) {
- for (let i = 0; i < formData.data.contractProjectList.length; i++) {
- if (formData.data.contractProjectList[i].amount) {
- money = parseFloat(
- Number(money) + Number(formData.data.contractProjectList[i].amount)
- ).toFixed(2);
- }
- }
- }
- formData.data.amount = money;
- };
- const clickAdd = () => {
- if (
- formData.data.contractProjectList &&
- formData.data.contractProjectList.length > 0
- ) {
- formData.data.contractProjectList.push({
- payName: "",
- amount: null,
- remark: "",
- });
- } else {
- formData.data.contractProjectList = [
- { payName: "", amount: null, remark: "" },
- ];
- }
- };
- const handleDelete = (index) => {
- formData.data.contractProjectList.splice(index, 1);
- totalAmount();
- };
- 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 handleBeforeUpload = async (file, index) => {
- formData.data.contractProductList[index].imgLoading = true;
- const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
- uploadData.value = res.uploadBody;
- formData.data.contractProductList[index].fileList = [
- {
- id: res.id,
- fileName: res.fileName,
- fileUrl: res.fileUrl,
- uploadState: false,
- },
- ];
- formData.data.contractProductList[index].fileData = res;
- return true;
- };
- const handleBeforeUploadOne = async (file, index) => {
- const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
- file.id = res.id;
- file.fileUrl = res.fileUrl;
- uploadData.value = res.uploadBody;
- formData.data.contractProductList[index].fileData = res;
- return true;
- };
- const handleSuccess = (index) => {
- if (
- formData.data.contractProductList[index].fileData &&
- formData.data.contractProductList[index].fileData.fileUrl
- ) {
- formData.data.contractProductList[index].uploadState = true;
- formData.data.contractProductList[index].imageUrl =
- formData.data.contractProductList[index].fileData.fileUrl;
- }
- setTimeout(() => {
- formData.data.contractProductList[index].imgLoading = false;
- }, 400);
- };
- const handleSuccessOne = (index) => {
- if (
- formData.data.contractProductList[index].fileData &&
- formData.data.contractProductList[index].fileData.fileUrl
- ) {
- let file = formData.data.contractProductList[index].fileData;
- formData.data.contractProductList[index].prodFileList.push({
- id: file.id,
- fileName: file.fileName,
- name: file.fileName,
- url: file.fileUrl,
- fileUrl: file.fileUrl,
- });
- formData.data.contractProductList[index].fileData = {};
- }
- };
- const handleRemoveFile = (file, index) => {
- let sonIndex = formData.data.contractProductList[
- index
- ].prodFileList.findIndex((x) => x.id == file.id || x.id == file.raw.id);
- if (sonIndex > -1) {
- formData.data.contractProductList[index].prodFileList.splice(sonIndex, 1);
- }
- };
- const onPreviewFile = (file) => {
- if (file && file.fileUrl) {
- window.open(file.fileUrl, "_blank");
- } else {
- window.open(file.raw.fileUrl, "_blank");
- }
- };
- const loadingSearch = ref(false);
- const remoteMethod = (keyword) => {
- if (keyword && typeof keyword === "string") {
- loadingSearch.value = true;
- proxy.post("/customer/selPage", { keyword }).then((res) => {
- customerList.value = res.rows.map((x) => ({
- ...x,
- label: x.name,
- value: x.id,
- }));
- loadingSearch.value = false;
- });
- }
- return;
- };
- const handleSubmit = async () => {
- let flag = await formDom.value.handleSubmit(() => {});
- if (flag) {
- if (
- formData.data.contractProductList &&
- formData.data.contractProductList.length > 0
- ) {
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- const ele = formData.data.contractProductList[i];
- if (ele.isShowProductFile && ele.fileListOne.length > 0) {
- ele.prodFileList = ele.fileListOne;
- }
- }
- formData.data.currency = currencyData.value[0].dictKey;
- return true;
- } else {
- proxy.msgTip("请添加至少一件商品", 2);
- return false;
- }
- } else {
-
-
-
-
- }
- return flag;
- };
- const getFormData = () => {
-
- formData.data.type = route.query.flowKey == "sample_flow" ? "1" : "0";
- return proxy.deepClone(formData.data);
- };
- defineExpose({
- getFormData,
- handleSubmit,
- });
- const changeShroffAccount = (val) => {
- if (val) {
- let data = accountList.value.find((item) => item.value == val);
- if (data) {
- formData.data.beneficiaryName = "";
- formData.data.beneficiaryBank = "";
- formData.data.beneficiaryBankAddress = "";
- formData.data.beneficiaryAccountNumber = "";
- formData.data.swiftCode = "";
- formData.data.beneficiaryAddress = "";
- formData.data.accountName = data.name;
- formData.data.openingBank = data.openingBank;
- formData.data.accountOpening = data.accountOpening;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- };
- const handleClickUpload = async (att, flag, index) => {
- let res = null;
- let path = "";
- if (flag) {
- proxy.msgTip("请稍后", 2);
- res = await proxy.post("/fileService/createTempFolder");
- if (res && res.path) {
- formData.data.contractProductList[index][att] = res.path;
- path = res.path;
- }
- } else {
- path = formData.data.contractProductList[index][att];
- }
- let a = document.createElement("a");
- a.href = "printer://" + "ftp://121.37.194.75/" + path + "/";
- a.style.display = "none";
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
- };
- const handleClickUploadOne = (index) => {
- formData.data.contractProductList[index].isShowProductFile =
- !formData.data.contractProductList[index].isShowProductFile;
- if (formData.data.contractProductList[index].isShowProductFile) {
- formData.data.contractProductList[index].prodFileList = [];
- formData.data.contractProductList[index].fileData = {};
- }
- };
- const getAllData = (businessId) => {
- proxy.post("/contract/detail", { id: businessId }).then(async (res) => {
- res.countryId = res.buyCountryId;
- res.provinceId = res.buyProvinceId;
- res.cityId = res.buyCityId;
- if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
- $bus.emit("getGrossData", res.grossProfitInfoList);
- }
- for (const key in res) {
- formData.data[key] = res[key];
- }
- formData.data.belongType = formData.data.belongType + "";
- formData.data.isFreight = formData.data.isFreight + "";
- formData.data.isTax = formData.data.isTax + "";
- remarkEditor.value.changeHtml(formData.data.templateContent);
- if (
- formData.data.contractProductList &&
- formData.data.contractProductList.length > 0
- ) {
- formData.data.contractProductList.forEach((x) => {
- x.rowId = uuidv4();
- });
- getFileData();
- let productIds = formData.data.contractProductList.map(
- (x) => x.productId
- );
-
-
-
-
-
-
-
-
- const productAllFile = await proxy.getFileData({
- businessIdList: productIds,
- getAll: true,
- });
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- const ele = formData.data.contractProductList[i];
- for (const key in productAllFile) {
- if (
- ele.productId == key &&
- productAllFile[ele.productId] &&
- productAllFile[ele.productId].length > 0
- ) {
- ele.productFile = productAllFile[ele.productId].filter(
- (x) => x.businessType == "0"
- );
- if (ele.productFile && ele.productFile.length > 0) {
- ele.fileUrl = ele.productFile[0].fileUrl;
- }
- break;
- }
- }
- }
- let ids = formData.data.contractProductList.map((x) => x.id);
- proxy
- .getFileData({
- businessIdList: ids,
- getAll: true,
- })
- .then((fileObj) => {
- if (fileObj && Object.keys(fileObj).length > 0) {
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- const ele = formData.data.contractProductList[i];
- for (const key in fileObj) {
- if (
- ele.id == key &&
- fileObj[ele.id] &&
- fileObj[ele.id].length > 0
- ) {
- let imageUrlList = fileObj[ele.id].filter(
- (x) => x.businessType == "0"
- );
- if (imageUrlList && imageUrlList.length > 0) {
- ele.imageUrl = imageUrlList[0].fileUrl;
- }
- ele.prodFileList = fileObj[ele.id]
- .filter((x) => x.businessType == "1")
- .map((x) => ({ ...x, name: x.fileName, url: x.fileUrl }));
- if (ele.prodFileList && ele.prodFileList.length > 0) {
- ele.isShowProductFile = false;
- } else {
- ele.isShowProductFile = true;
- if (productAllFile[ele.productId]) {
- ele.fileListOne = productAllFile[ele.productId].filter(
- (x) => x.businessType == "2"
- );
- }
- }
- }
- }
- }
- } else {
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- const ele = formData.data.contractProductList[i];
- ele.isShowProductFile = true;
- for (const key in productAllFile) {
- if (
- ele.productId == key &&
- productAllFile[ele.productId] &&
- productAllFile[ele.productId].length > 0
- ) {
- ele.fileListOne = productAllFile[ele.productId].filter(
- (x) => x.businessType == "2"
- );
- break;
- }
- }
- }
- }
- });
- changeProductPrice();
- }
- if (formData.data.countryId) {
- getCityData(formData.data.countryId, "20");
- }
- if (formData.data.provinceId) {
- getCityData(formData.data.provinceId, "30");
- }
- });
- };
- const getFileData = () => {
- let ids = [];
- formData.data.contractProductList.map((x) => {
-
- x.contractProductBomList.map((y) => {
- ids.push(y.materialId);
- });
- });
- ids = Array.from(new Set(ids));
- proxy
- .post("/fileInfo/getList", {
- businessIdList: ids,
- })
- .then((fileObj) => {
- formData.data.contractProductList.map((x) => {
-
-
-
- x.contractProductBomList.map((y) => {
- y.fileList = fileObj[y.materialId] || [];
- if (y.fileList && y.fileList.length > 0) {
- y.fileUrl = y.fileList[0].fileUrl;
- }
- });
- });
- });
- };
- const getPriceSheetData = (id) => {
- proxy.post("/extQuotation/detail", { id }).then(async (res) => {
- if (formData.data.deptId) {
- res.deptId = formData.data.deptId;
- }
- formData.data = res;
- formData.data = {
- contractType: route.query.contractType,
- templateContent: "",
- quotationId: res.id,
- companyId: res.companyId,
- ofCompanyId: res.ofCompanyId,
- deptId: res.deptId,
- buyCorporationId: res.buyCorporationId,
- buyAddress: res.buyAddress,
- buyPostalCode: res.buyPostalCode,
- buyContactName: res.buyContactName,
- buyContactNumber: res.buyContactNumber,
- amount: res.amount,
- };
-
-
-
-
-
-
-
-
-
- formData.data.contractProductList = res.quotationProductList.map((x) => ({
- quotationProductId: x.id,
- fileUrl: "",
- productId: x.productId,
- productCnName: x.productName,
- productCode: x.productCode,
- productLength: x.productLength,
- productWidth: x.productWidth,
- productHeight: x.productHeight,
- prodFilePath: x.productProdImgPath,
- quantity: x.quantity,
- price: x.price,
- amount: x.amount,
- fileList: [],
- contractProductBomList: x.quotationProductBomList.map((y) => {
- y.quotationProductBomId = y.id;
- delete y.id;
- return y;
- }),
- rowId: uuidv4(),
- }));
- changeProductPrice();
- getFileData();
- let productIds = formData.data.contractProductList.map((x) => x.productId);
- const productAllFile = await proxy.getFileData({
- businessIdList: productIds,
- getAll: true,
- });
- for (let i = 0; i < formData.data.contractProductList.length; i++) {
- const ele = formData.data.contractProductList[i];
- for (const key in productAllFile) {
- if (
- ele.productId == key &&
- productAllFile[ele.productId] &&
- productAllFile[ele.productId].length > 0
- ) {
- ele.productFile = productAllFile[ele.productId].filter(
- (x) => x.businessType == "0"
- );
- if (ele.productFile && ele.productFile.length > 0) {
- ele.fileUrl = ele.productFile[0].fileUrl;
- }
- ele.fileListOne = productAllFile[ele.productId].filter(
- (x) => x.businessType == "2"
- );
- if (ele.fileListOne && ele.fileListOne.length > 0) {
- ele.isShowProductFile = true;
- } else {
- ele.isShowProductFile = false;
- }
- break;
- }
- }
- }
- formData.data.countryId = res.buyCountryId;
- formData.data.provinceId = res.buyProvinceId;
- formData.data.cityId = res.buyCityId;
- if (formData.data.countryId) {
- getCityData(formData.data.countryId, "20");
- }
- if (formData.data.provinceId) {
- getCityData(formData.data.provinceId, "30");
- }
- });
- };
- const isEditList = ref(true);
- onMounted(() => {
- formData.data.ofCompanyId = proxy.useUserStore().user.companyId;
- handleOfCompanyIdChange(formData.data.ofCompanyId);
- if (
- proxy.useUserStore().currentCompany == proxy.useUserStore().user.ofCompanyId
- ) {
- formData.data.deptId = proxy.useUserStore().user.deptId;
- }
- if (currencyData.value && currencyData.value.length > 0) {
- formData.data.currency = currencyData.value[0].dictKey;
- }
- formOption.disabled = judgeStatus();
-
- if (route.query && route.query.priceSheetId) {
- getPriceSheetData(route.query.priceSheetId);
- isEditList.value = false;
- } else if (route.query && route.query.businessId && route.query.processType) {
- let businessId = route.query.businessId;
- getAllData(businessId);
- } else if (
- route.query &&
- route.query.businessId &&
- !route.query.processType
- ) {
- let businessId = route.query.businessId;
- getAllData(businessId);
- }
- });
- watch(
- () => props.queryData,
- (val) => {
- nextTick(() => {
- formOption.disabled = judgeStatus();
- });
- if (val.businessId && val.processType) {
- getAllData(val.businessId);
- }
- },
- {
- deep: true,
- immediate: true,
- }
- );
- const showPriceInfo = () => {
- if (props.queryData.processType) {
- return false;
- }
- if (route.query.processType) {
- return false;
- } else {
- return true;
- }
- };
- const optionTwo = reactive({
- data: {
- tooltip: {
- trigger: "axis",
- },
-
-
-
- grid: {
- left: "3%",
- right: "4%",
- top: "10%",
- bottom: "3%",
- containLabel: true,
- },
-
-
-
-
-
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: [],
- },
- yAxis: {
- type: "value",
- },
- series: [
- {
- name: "价格",
- type: "line",
- data: [],
- },
- ],
- },
- });
- const showEcharts = (row, index) => {
- let myChart = null;
- myChart = echarts.init(proxy.$refs[row.productId + index]);
- window.addEventListener("resize", () => {
- myChart.resize();
- });
- if (row.contractProductListOne && row.contractProductListOne.length > 0) {
- optionTwo.data.xAxis.data = row.contractProductListOne.map((item) => {
- return item.createTime.slice(0, 10);
- });
- optionTwo.data.series[0].data = row.contractProductListOne.map((item) => {
- return item.price;
- });
- } else {
- optionTwo.data.xAxis.data = [];
- optionTwo.data.series[0].data = [];
- }
- myChart.setOption(optionTwo.data);
- myChart.resize();
- };
- const clickCopy = (type) => {
- copyType.value = type;
- copyContract.value = true;
- };
- </script>
- <style lang="scss" scoped>
- .img {
- object-fit: contain;
- width: 16px;
- height: 16px;
- vertical-align: middle;
- }
- .pic {
- object-fit: contain;
- width: 50px;
- height: 50px;
- cursor: pointer;
- vertical-align: middle;
- }
- .el-icon.avatar-uploader-icon {
- font-size: 20px;
- color: #8c939d;
- width: 50px;
- height: 50px;
- text-align: center;
- border: 1px dashed var(--el-border-color);
- }
- .ql-editor {
- padding: 0px;
- }
- :deep(.el-upload-list) {
- margin: 0px !important;
- position: relative;
- top: -8px;
- left: -8px;
- }
- :deep(.el-upload-list--text .el-upload-list__item) {
- min-width: 150px !important;
- }
- :deep(.bom-table .el-table__body-wrapper .el-table__body .el-table__row) {
- background: #f4f4f5 !important;
- }
- </style>
|