inventoryTable.vue 89 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873
  1. <template>
  2. <el-form ref="form" :model="form" :rules="rules">
  3. <ele-pro-table
  4. ref="table"
  5. :needPage="false"
  6. :columns="columns"
  7. :datasource="form.datasource"
  8. class="time-form"
  9. height="300"
  10. full-height="calc(100vh - 76px)"
  11. @columns-change="handleColumnChange"
  12. @header-dragend="handleHeaderDragend"
  13. :cache-key="cacheKeyUrl"
  14. :selection.sync="selection"
  15. >
  16. <!-- :show-summary="showSummary"
  17. :summary-method="getSummaries" -->
  18. <!-- 表头工具栏 -->
  19. <template v-slot:toolbar>
  20. <div class="headbox">
  21. <div>
  22. <el-button
  23. size="small"
  24. type="primary"
  25. icon="el-icon-plus"
  26. class="ele-btn-icon"
  27. @click="handParent('', -1)"
  28. >
  29. 新增
  30. </el-button>
  31. <el-button
  32. size="small"
  33. type="primary"
  34. icon="el-icon-plus"
  35. class="ele-btn-icon"
  36. v-if="isGoods"
  37. @click="handGoods(-1)"
  38. >
  39. 选择商品
  40. </el-button>
  41. <el-button
  42. size="small"
  43. type="primary"
  44. icon="el-icon-plus"
  45. class="ele-btn-icon"
  46. v-if="isTemporary"
  47. @click="handlAdd"
  48. >
  49. 新增临时产品
  50. </el-button>
  51. <el-button
  52. size="small"
  53. type="primary"
  54. class="ele-btn-icon"
  55. @click="save"
  56. v-if="isDrawer"
  57. >
  58. 保存
  59. </el-button>
  60. <setAllValue
  61. :disabled="!selection.length"
  62. title="客户期望交期"
  63. @success="setAllValueChange"
  64. valueKey="customerExpectDeliveryDeadline"
  65. />
  66. <setAllValue
  67. :disabled="!selection.length"
  68. title="生产交付交期"
  69. valueKey="produceDeliveryDeadline"
  70. @success="setAllValueChange"
  71. />
  72. <setAllValue
  73. :disabled="!selection.length"
  74. inputType="number"
  75. title="税率"
  76. valueKey="taxRate"
  77. @success="setAllTaxRateChange"
  78. />
  79. </div>
  80. <div class="pricebox">
  81. <span class="amount" v-if="showSummary"
  82. >数量合计:{{ allQuantity }}</span
  83. >
  84. <span class="amount">总计:{{ allPrice }}元</span>
  85. <el-form-item
  86. style="width: 300px"
  87. v-if="isDiscountTotalPrice"
  88. label="优惠后总金额:"
  89. prop="discountTotalPrice"
  90. :rules="{
  91. required: true,
  92. message: '请输入优惠后总金额',
  93. trigger: 'change'
  94. }"
  95. >
  96. <el-input
  97. type="number"
  98. :min="0"
  99. :max="allPrice"
  100. :disabled="!allPrice"
  101. v-model="form.discountTotalPrice"
  102. style="width: 180px"
  103. placeholder="请输入"
  104. @input="discountInputByOrder(form.discountTotalPrice)"
  105. >
  106. <template slot="append">元</template>
  107. </el-input>
  108. </el-form-item>
  109. </div>
  110. </div>
  111. </template>
  112. <template v-slot:productName="{ row, $index }">
  113. <el-form-item
  114. :prop="'datasource.' + $index + '.productName'"
  115. :rules="{
  116. required: true,
  117. message: '请输入',
  118. trigger: 'change'
  119. }"
  120. >
  121. <el-input
  122. :disabled="!!row.productId && row.productId != 0"
  123. v-model="row.productName"
  124. placeholder="请输入"
  125. style="width: 60%; margin-right: 10px"
  126. ></el-input>
  127. <el-button
  128. size="small"
  129. type="primary"
  130. @click.native="handParent(row, $index)"
  131. >选择
  132. </el-button>
  133. </el-form-item>
  134. </template>
  135. <template v-slot:sortCode="scope">
  136. <el-form-item prop="sortCode">
  137. <el-input
  138. v-model="scope.row.sortCode"
  139. placeholder="请输入"
  140. type="number"
  141. min="1"
  142. ></el-input>
  143. </el-form-item>
  144. </template>
  145. <template v-slot:entrustedEnterpriseId="scope">
  146. <el-form-item prop="entrustedEnterpriseId">
  147. <el-select
  148. v-model="scope.row.entrustedEnterpriseId"
  149. clearable
  150. filterable
  151. >
  152. <el-option
  153. v-for="i in scope.row.entrustedEnterpriseIdList"
  154. :key="i.id"
  155. :value="i.id"
  156. :label="i.name"
  157. ></el-option>
  158. </el-select>
  159. </el-form-item>
  160. </template>
  161. <template v-slot:headerCustomerMark="{ column }">
  162. <span class="is-required">{{ column.label }}</span>
  163. </template>
  164. <template v-slot:customerMark="{ row, $index }">
  165. <el-form-item
  166. :prop="'datasource.' + $index + '.customerMark'"
  167. :rules="{
  168. required: isCustomerMark ? true : false,
  169. message: '请输入客户代号',
  170. trigger: 'change'
  171. }"
  172. >
  173. <el-input
  174. v-model="row.customerMark"
  175. :disabled="quoteType === 2"
  176. placeholder="请输入"
  177. ></el-input>
  178. </el-form-item>
  179. </template>
  180. <template v-slot:headerProductName="{ column }">
  181. <span class="is-required">{{ column.label }}</span>
  182. </template>
  183. <template v-slot:productCode="scope">
  184. <el-form-item :prop="'datasource.' + scope.$index + '.productCode'">
  185. <el-input
  186. v-model="scope.row.productCode"
  187. :disabled="
  188. quoteType != 2 ||
  189. (!!scope.row.productId && scope.row.productId != 0)
  190. "
  191. ></el-input>
  192. </el-form-item>
  193. </template>
  194. <template v-slot:productCategoryName="scope">
  195. <el-form-item
  196. :prop="'datasource.' + scope.$index + '.productCategoryName'"
  197. >
  198. <el-input v-model="scope.row.productCategoryName" disabled></el-input>
  199. </el-form-item>
  200. </template>
  201. <template v-slot:headerTotalCount="{ column }">
  202. <span :class="{ 'is-required': isTotalCount }">{{ column.label }}</span>
  203. </template>
  204. <template v-slot:headerTaxRate="{ column }">
  205. <span class="is-required">{{ column.label }}</span>
  206. </template>
  207. <template v-slot:totalPrice="scope">
  208. <el-form-item :prop="'datasource.' + scope.$index + '.totalPrice'">
  209. {{ formatPrice(Number(scope.row.totalPrice) || 0) }}元
  210. </el-form-item>
  211. </template>
  212. <template v-slot:productBrand="scope">
  213. <el-form-item :prop="'datasource.' + scope.$index + '.productBrand'">
  214. <el-input
  215. v-model="scope.row.productBrand"
  216. :disabled="!!scope.row.productId && scope.row.productId != 0"
  217. ></el-input>
  218. </el-form-item>
  219. </template>
  220. <template v-slot:modelType="scope">
  221. <el-form-item :prop="'datasource.' + scope.$index + '.modelType'">
  222. <el-input
  223. v-model="scope.row.modelType"
  224. :disabled="!!scope.row.productId && scope.row.productId != 0"
  225. ></el-input>
  226. </el-form-item>
  227. </template>
  228. <template v-slot:specification="scope">
  229. <el-form-item :prop="'datasource.' + scope.$index + '.specification'">
  230. <el-input
  231. v-model="scope.row.specification"
  232. :disabled="!!scope.row.productId && scope.row.productId != 0"
  233. ></el-input>
  234. </el-form-item>
  235. </template>
  236. <template v-slot:guaranteePeriod="scope">
  237. <div class="period">
  238. <div class="borderleftnone">
  239. <el-form-item
  240. :prop="'datasource.' + scope.$index + '.guaranteePeriod'"
  241. :rules="{
  242. pattern: numberReg,
  243. message: '请输入有效期',
  244. trigger: 'blur'
  245. }"
  246. >
  247. <el-input
  248. v-model="scope.row.guaranteePeriod"
  249. @change="
  250. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  251. "
  252. placeholder="请输入"
  253. ></el-input>
  254. </el-form-item>
  255. </div>
  256. <div class="borderrightnone">
  257. <DictSelection
  258. dictName="质保期单位"
  259. clearable
  260. v-model="scope.row.guaranteePeriodUnitCode"
  261. @change="
  262. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  263. "
  264. :isOne="scope.$index === 0"
  265. >
  266. </DictSelection>
  267. </div>
  268. </div>
  269. </template>
  270. <!-- <template v-slot:measuringUnit="scope">
  271. <el-form-item :prop="'datasource.' + scope.$index + '.measuringUnit'">
  272. <el-input
  273. v-model="scope.row.measuringUnit"
  274. :disabled="!!scope.row.productCode"
  275. placeholder="请输入"
  276. ></el-input>
  277. </el-form-item>
  278. </template> -->
  279. <template v-slot:remark="scope">
  280. <el-form-item :prop="'datasource.' + scope.$index + '.remark'">
  281. <el-input
  282. v-model="scope.row.remark"
  283. type="textarea"
  284. placeholder="请输入"
  285. ></el-input>
  286. </el-form-item>
  287. </template>
  288. <template v-slot:singlePrice="scope">
  289. <el-form-item
  290. :prop="'datasource.' + scope.$index + '.singlePrice'"
  291. :rules="{
  292. required: quoteType !== 2 && isSinglePrice ? true : false,
  293. message: '请输入单价',
  294. trigger: 'change'
  295. }"
  296. >
  297. <el-input
  298. v-model="scope.row.singlePrice"
  299. placeholder="请输入"
  300. :disabled="quoteType === 2"
  301. @input="handleCountChange(scope.row, scope.$index)"
  302. type="number"
  303. >
  304. <template slot="append">元</template>
  305. </el-input>
  306. </el-form-item>
  307. </template>
  308. <template v-slot:taxRate="scope">
  309. <el-form-item
  310. :prop="'datasource.' + scope.$index + '.taxRate'"
  311. :rules="{
  312. required: isTaxRate == 1 ? true : false,
  313. message: '请输入税率',
  314. trigger: 'change'
  315. }"
  316. >
  317. <el-input
  318. v-model="scope.row.taxRate"
  319. placeholder="请输入"
  320. type="number"
  321. :disabled="quoteType === 2"
  322. @input="getNotaxSinglePrice"
  323. >
  324. <template slot="append">%</template>
  325. </el-input>
  326. </el-form-item>
  327. </template>
  328. <template v-slot:headerSinglePrice="{ column }">
  329. <span :class="isSinglePrice ? 'is-required' : ''">{{
  330. column.label
  331. }}</span>
  332. </template>
  333. <template v-slot:headerCustomerExpectDeliveryDeadline="{ column }">
  334. <span :class="isDate == 1 ? 'is-required' : ''">{{
  335. column.label
  336. }}</span>
  337. </template>
  338. <template v-slot:technicalAnswerName="{ row, $index }">
  339. <el-form-item :prop="'datasource.' + $index + '.technicalAnswerName'">
  340. <el-input
  341. v-model="row.technicalAnswerName"
  342. placeholder="请输入"
  343. @click.native="handHead(row, $index)"
  344. ></el-input>
  345. </el-form-item>
  346. </template>
  347. <template v-slot:technicalParams="scope">
  348. <el-form-item :prop="'datasource.' + scope.$index + '.technicalParams'">
  349. <el-input
  350. type="textarea"
  351. v-model="scope.row.technicalParams"
  352. placeholder="请输入"
  353. ></el-input>
  354. </el-form-item>
  355. </template>
  356. <template v-slot:technicalDrawings="scope">
  357. <el-form-item
  358. :prop="'datasource.' + scope.$index + '.technicalDrawings'"
  359. >
  360. <fileMain v-model="scope.row.technicalDrawings"></fileMain>
  361. </el-form-item>
  362. </template>
  363. <template v-slot:customerReqFiles="scope">
  364. <el-form-item
  365. :prop="'datasource.' + scope.$index + '.customerReqFiles'"
  366. >
  367. <fileMain v-model="scope.row.customerReqFiles"></fileMain>
  368. </el-form-item>
  369. </template>
  370. <template v-slot:industryArtFiles="scope">
  371. <el-form-item
  372. :prop="'datasource.' + scope.$index + '.industryArtFiles'"
  373. :rules="{
  374. required: false,
  375. message: '请输入',
  376. trigger: 'change'
  377. }"
  378. >
  379. <fileMain v-model="scope.row.industryArtFiles"></fileMain>
  380. </el-form-item>
  381. </template>
  382. <template v-slot:otherFiles="scope">
  383. <el-form-item :prop="'datasource.' + scope.$index + '. otherFiles'">
  384. <fileMain v-model="scope.row.otherFiles"></fileMain>
  385. </el-form-item>
  386. </template>
  387. <template v-slot:headerProduceDeliveryDeadline="{ column }">
  388. <span
  389. :class="isProduceDeliveryDeadline && isDate == 1 ? 'is-required' : ''"
  390. >{{ column.label }}</span
  391. >
  392. </template>
  393. <template v-slot:produceDeliveryDeadline="scope">
  394. <el-form-item
  395. :prop="'datasource.' + scope.$index + '.produceDeliveryDeadline'"
  396. :rules="{
  397. required: isProduceDeliveryDeadline && isDate == 1 ? true : false,
  398. message: '选择生产交付交期',
  399. trigger: 'change'
  400. }"
  401. >
  402. <el-date-picker
  403. style="width: 140px"
  404. value-format="yyyy-MM-dd"
  405. v-model="scope.row.produceDeliveryDeadline"
  406. @change="
  407. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  408. "
  409. type="date"
  410. placeholder="选择日期"
  411. >
  412. </el-date-picker>
  413. </el-form-item>
  414. </template>
  415. <template v-slot:customerExpectDeliveryDeadline="scope">
  416. <el-form-item
  417. v-if="scope.row.arrivalWay == 1 || !scope.row.arrivalWay"
  418. :rules="{
  419. required: isDate == 1 && quoteType != 2 ? true : false,
  420. message:
  421. contractBookType == 1 ? '请选择客户期望交期' : '请选择交付日期',
  422. trigger: 'change'
  423. }"
  424. :prop="
  425. 'datasource.' + scope.$index + '.customerExpectDeliveryDeadline'
  426. "
  427. >
  428. <el-date-picker
  429. style="width: 140px"
  430. v-model="scope.row.customerExpectDeliveryDeadline"
  431. value-format="yyyy-MM-dd"
  432. @change="
  433. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  434. "
  435. type="date"
  436. placeholder="选择日期"
  437. >
  438. </el-date-picker>
  439. </el-form-item>
  440. <el-form-item v-if="scope.row.arrivalWay == 2">
  441. <el-link
  442. type="primary"
  443. :underline="false"
  444. @click.native="handleMethod(scope.row, scope.$index)"
  445. >
  446. 设置分批时间
  447. </el-link>
  448. </el-form-item>
  449. </template>
  450. <template v-slot:provenance="scope">
  451. <el-form-item :prop="'datasource.' + scope.$index + '.provenance'">
  452. <DictSelection
  453. dictName="产地"
  454. clearable
  455. v-model="scope.row.provenance"
  456. :disabled="quoteType === 2"
  457. collapse-tags
  458. multiple
  459. :isOne="scope.$index === 0"
  460. >
  461. </DictSelection>
  462. </el-form-item>
  463. </template>
  464. <template v-slot:guaranteePeriodDeadline="scope">
  465. <el-form-item
  466. :prop="'datasource.' + scope.$index + '.guaranteePeriodDeadline'"
  467. >
  468. <el-date-picker
  469. style="width: 140px"
  470. v-model="scope.row.guaranteePeriodDeadline"
  471. type="date"
  472. value-format="yyyy-MM-dd"
  473. placeholder="选择日期"
  474. >
  475. </el-date-picker>
  476. </el-form-item>
  477. </template>
  478. <template v-slot:singleWeight="scope">
  479. <el-form-item :prop="'datasource.' + scope.$index + '.singleWeight'">
  480. <el-input
  481. v-model="scope.row.singleWeight"
  482. @input="handleCountChange(scope.row, scope.$index)"
  483. placeholder="请输入"
  484. >
  485. <template slot="append">
  486. <span v-if="!!scope.row.productId && scope.row.productId != 0">
  487. {{ scope.row.weightUnit }}
  488. </span>
  489. <el-input
  490. v-else
  491. v-model="scope.row.weightUnit"
  492. placeholder="单位"
  493. style="width: 80px; padding: 0"
  494. ></el-input>
  495. </template>
  496. </el-input>
  497. </el-form-item>
  498. </template>
  499. <template v-slot:totalWeight="scope">
  500. <el-form-item
  501. style="margin-bottom: 20px"
  502. :rules="{
  503. required: false,
  504. pattern: numberReg,
  505. trigger: 'change',
  506. message: '请输入正确的重量'
  507. }"
  508. :prop="'datasource.' + scope.$index + '.totalWeight'"
  509. >
  510. <el-input
  511. v-model="scope.row.totalWeight"
  512. @input="handleCountChange(scope.row, scope.$index, 'totalWeight')"
  513. placeholder="请输入"
  514. >
  515. <template slot="append">
  516. {{ scope.row.weightUnit }}
  517. </template>
  518. </el-input>
  519. </el-form-item>
  520. </template>
  521. <template v-slot:increaseTotalWeight="scope">
  522. <el-form-item
  523. :prop="'datasource.' + scope.$index + '.increaseTotalWeight'"
  524. >
  525. <el-input
  526. v-model="scope.row.increaseTotalWeight"
  527. @input="setIncreaseTotalWeight(scope.row, scope.$index)"
  528. placeholder="请输入"
  529. >
  530. <template slot="append">
  531. <span v-if="!!scope.row.productId && scope.row.productId != 0">
  532. {{ scope.row.weightUnit }}
  533. </span>
  534. <el-input
  535. v-else
  536. v-model="scope.row.weightUnit"
  537. placeholder="单位"
  538. style="width: 80px; padding: 0"
  539. ></el-input>
  540. </template>
  541. </el-input>
  542. </el-form-item>
  543. </template>
  544. <template v-slot:technologyRouteName="scope">
  545. <el-form-item
  546. :prop="'datasource.' + scope.$index + '.technologyRouteName'"
  547. :rules="{
  548. required: false,
  549. message: '请选择',
  550. trigger: 'change'
  551. }"
  552. >
  553. <el-input
  554. v-model="scope.row.technologyRouteName"
  555. placeholder="请选择"
  556. @click.native="openVersion(scope.$index)"
  557. ></el-input>
  558. </el-form-item>
  559. </template>
  560. <template v-slot:pricingWay="scope">
  561. <el-form-item :prop="'datasource.' + scope.$index + '.pricingWay'">
  562. <el-select
  563. v-model="scope.row.pricingWay"
  564. placeholder="请选择"
  565. :rules="{
  566. required: true,
  567. message: '请选择计价方式',
  568. trigger: 'change'
  569. }"
  570. @change="changeCount(scope.row, scope.$index)"
  571. >
  572. <el-option
  573. v-for="item in pricingWayList"
  574. :key="item.id"
  575. :label="item.name"
  576. :value="item.id"
  577. >
  578. </el-option>
  579. </el-select>
  580. </el-form-item>
  581. </template>
  582. <template v-slot:headerPricingWay="{ column }">
  583. <span class="is-required">{{ column.label }}</span>
  584. </template>
  585. <template v-slot:taskName="scope">
  586. <el-form-item :prop="'datasource.' + scope.$index + '.taskName'">
  587. <el-input
  588. v-model="scope.row.taskName"
  589. placeholder="请选择"
  590. style="width: 60%; margin-right: 10px"
  591. disabled
  592. ></el-input>
  593. <el-button
  594. size="small"
  595. type="primary"
  596. @click.native="handleTaskinstance(scope.row, scope.$index)"
  597. >选择
  598. </el-button>
  599. </el-form-item>
  600. </template>
  601. <template v-slot:arrivalWay="scope">
  602. <el-form-item :prop="'datasource.' + scope.$index + '.arrivalWay'">
  603. <el-select
  604. v-model="scope.row.arrivalWay"
  605. clearable
  606. style="width: 100%"
  607. >
  608. <el-option
  609. v-for="item in arrivalWayList"
  610. :key="item.value"
  611. :label="item.label"
  612. :value="item.value"
  613. >
  614. </el-option>
  615. </el-select>
  616. </el-form-item>
  617. </template>
  618. <template v-slot:batchNo="scope">
  619. <el-form-item
  620. :prop="'datasource.' + scope.$index + '.batchNo'"
  621. :rules="[
  622. {
  623. required: isBatchNo == 1 ? true : false,
  624. message: '请输入批号',
  625. trigger: 'blur'
  626. }
  627. ]"
  628. >
  629. <el-input
  630. v-model="scope.row.batchNo"
  631. placeholder="请输入"
  632. :disabled="quoteType === 2"
  633. >
  634. <!-- 批次号可以为中文 -->
  635. <!-- v-no-chinese -->
  636. </el-input>
  637. </el-form-item>
  638. </template>
  639. <template v-slot:headerBatchNo="{ column }">
  640. <span class="is-required">{{ column.label }}</span>
  641. </template>
  642. <template v-slot:orderNo="{ row, $index }">
  643. <el-form-item :prop="'datasource.' + $index + '.orderNo'">
  644. <el-select v-model="row.orderNo" style="width: 100%">
  645. <el-option
  646. :label="item.orderNo"
  647. :value="item.orderNo"
  648. @click.native="orderNoChange(row, item)"
  649. v-for="(item, index) in orderOption"
  650. :key="index"
  651. ></el-option>
  652. </el-select>
  653. </el-form-item>
  654. </template>
  655. <template v-slot:goodsLevel="{ row, $index }">
  656. <el-form-item :prop="'datasource.' + $index + '.goodsLevel'">
  657. <el-select
  658. v-model="row.goodsLevel"
  659. style="width: 100%"
  660. :disabled="quoteType === 2"
  661. >
  662. <el-option
  663. :label="item.label"
  664. :value="item.value"
  665. v-for="(item, index) in levelList"
  666. :key="index"
  667. ></el-option>
  668. </el-select>
  669. </el-form-item>
  670. </template>
  671. <template v-slot:goodsPriceType="{ row, $index }">
  672. <el-form-item :prop="'datasource.' + $index + '.goodsPriceType'">
  673. <DictSelection
  674. dictName="商品价格类型"
  675. clearable
  676. :disabled="quoteType === 2"
  677. v-model="row.goodsPriceType"
  678. @change="goodsPriceTypeChange(row, $index)"
  679. :isOne="$index === 0"
  680. >
  681. </DictSelection>
  682. </el-form-item>
  683. </template>
  684. <template v-slot:saleCount="scope">
  685. <el-form-item
  686. :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
  687. :rules="{
  688. required: quoteType !== 2 && isTotalCount ? true : false,
  689. message: '请输入数量',
  690. trigger: 'change'
  691. }"
  692. >
  693. <el-input
  694. v-model="scope.row[countObj.countKey]"
  695. style="width: calc(100% - 36px)"
  696. placeholder="请输入"
  697. type="number"
  698. :min="0"
  699. @input="handleCountChange(scope.row, scope.$index)"
  700. >
  701. <template slot="append">
  702. <el-select
  703. v-model="scope.row[countObj.unitIdKey]"
  704. style="width: 100px"
  705. v-if="!!scope.row.productId && scope.row.productId != 0"
  706. @change="handleCountChange(scope.row, scope.$index)"
  707. >
  708. <el-option
  709. :label="item.conversionUnit"
  710. :value="item.id"
  711. v-for="(item, index) in scope.row.packageDispositionList"
  712. :key="index"
  713. ></el-option>
  714. </el-select>
  715. <el-input
  716. v-else
  717. v-model="scope.row.measuringUnit"
  718. placeholder="单位"
  719. style="width: 100px; padding: 0"
  720. ></el-input>
  721. </template>
  722. </el-input>
  723. </el-form-item>
  724. </template>
  725. <template v-slot:quoteWay="scope">
  726. <el-form-item
  727. :prop="'datasource.' + scope.$index + '.quoteWay'"
  728. :rules="{
  729. required: true,
  730. message: '请选择报价方式',
  731. trigger: 'change'
  732. }"
  733. >
  734. <el-select v-model="scope.row.quoteWay" clearable filterable>
  735. <el-option
  736. v-for="i in quoteTypeOp"
  737. :key="i.value"
  738. :value="i.value"
  739. :label="i.label"
  740. ></el-option>
  741. </el-select>
  742. </el-form-item>
  743. </template>
  744. <template v-slot:headerQuoteWay="{ column }">
  745. <span class="is-required">{{ column.label }}</span>
  746. </template>
  747. <template v-slot:discountRatio="scope">
  748. <el-form-item
  749. :prop="'datasource.' + scope.$index + '.discountRatio'"
  750. :rules="{
  751. required: true,
  752. message: '请输入折让比例',
  753. trigger: 'change'
  754. }"
  755. >
  756. <el-input
  757. v-model="scope.row.discountRatio"
  758. placeholder="请输入"
  759. type="number"
  760. :min="0"
  761. :max="100"
  762. :disabled="quoteType === 2"
  763. @input="getDiscountRatioPrice(scope.row)"
  764. >
  765. <template slot="append">%</template>
  766. </el-input>
  767. </el-form-item>
  768. </template>
  769. <template v-slot:headerDiscountRatio="{ column }">
  770. <span :class="isDiscount ? 'is-required' : ''">{{ column.label }}</span>
  771. </template>
  772. <!-- <template v-slot:saleUnit="scope">
  773. <el-form-item
  774. :prop="'datasource.' + scope.$index + '.' + countObj.unitIdKey"
  775. >
  776. <el-select
  777. v-model="scope.row[countObj.unitIdKey]"
  778. style="width: 100%"
  779. @change="changeCount(scope.row, scope.$index)"
  780. >
  781. <el-option
  782. :label="item.conversionUnit"
  783. :value="item.id"
  784. @click.native="packingChange(item, scope.$index)"
  785. v-for="(item, index) in scope.row.packageDispositionList"
  786. :key="index"
  787. ></el-option>
  788. </el-select>
  789. </el-form-item>
  790. </template> -->
  791. <template v-slot:modelKey="scope">
  792. <el-form-item :prop="'datasource.' + scope.$index + '.' + 'modelKey'">
  793. <DictSelection
  794. dictName="物品机型"
  795. clearable
  796. :disabled="quoteType === 2"
  797. v-model="scope.row.modelKey"
  798. :isOne="scope.$index === 0"
  799. filterable
  800. allow-create
  801. default-first-option
  802. >
  803. </DictSelection>
  804. </el-form-item>
  805. </template>
  806. <template v-slot:colorKey="scope">
  807. <el-form-item :prop="'datasource.' + scope.$index + '.' + 'colorKey'">
  808. <DictSelection
  809. dictName="物品颜色"
  810. clearable
  811. v-model="scope.row.colorKey"
  812. :isOne="scope.$index === 0"
  813. filterable
  814. allow-create
  815. default-first-option
  816. >
  817. </DictSelection>
  818. </el-form-item>
  819. </template>
  820. <!-- 生产加工类型特有列的模板 -->
  821. <template v-slot:thickNess="{ row, $index }">
  822. <el-form-item :prop="'datasource.' + $index + '.thickNess'">
  823. <el-input v-model="row.thickNess" placeholder="请输入">
  824. <template slot="append">mm</template></el-input
  825. >
  826. </el-form-item>
  827. </template>
  828. <template v-slot:squareNumber="{ row, $index }">
  829. <el-form-item :prop="'datasource.' + $index + '.squareNumber'">
  830. <el-input v-model="row.squareNumber" placeholder="请输入">
  831. <template slot="append">m²</template></el-input
  832. >
  833. </el-form-item>
  834. </template>
  835. <template v-slot:processingFeeBeforeTax="{ row, $index }">
  836. <el-form-item
  837. :prop="'datasource.' + $index + '.processingFeeBeforeTax'"
  838. >
  839. <el-input
  840. v-model="row.processingFeeBeforeTax"
  841. type="number"
  842. placeholder="请输入"
  843. @input="calculateIncludingTaxPrice(row, $index)"
  844. >
  845. <template slot="append">元</template>
  846. </el-input>
  847. </el-form-item>
  848. </template>
  849. <template v-slot:packagingFeeNotTaxed="{ row, $index }">
  850. <el-form-item :prop="'datasource.' + $index + '.packagingFeeNotTaxed'">
  851. <el-input
  852. v-model="row.packagingFeeNotTaxed"
  853. type="number"
  854. placeholder="请输入"
  855. @input="calculateIncludingTaxPrice(row, $index)"
  856. >
  857. <template slot="append">元</template>
  858. </el-input>
  859. </el-form-item>
  860. </template>
  861. <template v-slot:transportationFeeWithoutTax="{ row, $index }">
  862. <el-form-item
  863. :prop="'datasource.' + $index + '.transportationFeeWithoutTax'"
  864. >
  865. <el-input
  866. v-model="row.transportationFeeWithoutTax"
  867. type="number"
  868. placeholder="请输入"
  869. @input="calculateIncludingTaxPrice(row, $index)"
  870. >
  871. <template slot="append">元</template>
  872. </el-input>
  873. </el-form-item>
  874. </template>
  875. <!-- 新增未税小记列模板 -->
  876. <template v-slot:quotationSubtotalBeforeTax="{ row, $index }">
  877. <el-form-item
  878. :prop="'datasource.' + $index + '.quotationSubtotalBeforeTax'"
  879. >
  880. {{ (Number(row.quotationSubtotalBeforeTax) || 0).toFixed(2) }}元
  881. </el-form-item>
  882. </template>
  883. <template v-slot:extraTax="{ row, $index }">
  884. <el-form-item :prop="'datasource.' + $index + '.extraTax'">
  885. <el-input
  886. v-model="row.extraTax"
  887. type="number"
  888. placeholder="请输入"
  889. @input="calculateIncludingTaxPrice(row, $index)"
  890. >
  891. <template slot="append">%</template>
  892. </el-input>
  893. </el-form-item>
  894. </template>
  895. <!-- 含税单价改为含税小计 -->
  896. <template v-slot:quotationSubtotalTax="{ row, $index }">
  897. <el-form-item :prop="'datasource.' + $index + '.quotationSubtotalTax'">
  898. {{ (Number(row.quotationSubtotalTax) || 0).toFixed(2) }}元
  899. <!-- <el-input
  900. v-model="row.quotationSubtotalTax"
  901. type="number"
  902. placeholder="请输入"
  903. >
  904. <template slot="append">元</template>
  905. </el-input> -->
  906. </el-form-item>
  907. </template>
  908. <template v-slot:productionRequirements="{ row, $index }">
  909. <el-form-item
  910. :prop="'datasource.' + $index + '.productionRequirements'"
  911. >
  912. <el-input
  913. v-model="row.productionRequirements"
  914. placeholder="请输入"
  915. type="textarea"
  916. >
  917. </el-input>
  918. </el-form-item>
  919. </template>
  920. <template v-slot:cuttingLength="{ row, $index }">
  921. <el-form-item :prop="'datasource.' + $index + '.cuttingLength'">
  922. <el-input v-model="row.cuttingLength" placeholder="请输入">
  923. </el-input>
  924. </el-form-item>
  925. </template>
  926. <!-- 操作列 -->
  927. <template v-slot:action="scope">
  928. <el-popconfirm
  929. class="ele-action"
  930. title="确定要删除吗?"
  931. @confirm="remove(scope.$index)"
  932. >
  933. <template v-slot:reference>
  934. <el-link type="danger" :underline="false" icon="el-icon-delete">
  935. 删除
  936. </el-link>
  937. </template>
  938. </el-popconfirm>
  939. </template>
  940. </ele-pro-table>
  941. <product-list
  942. ref="productListRef"
  943. classType="1"
  944. :is-get-inventory-total="true"
  945. :show-stock-count="showStockCount"
  946. @changeParent="changeParent"
  947. :isSupplier="isSupplier"
  948. :isSalesRecord="isSalesRecord"
  949. ></product-list>
  950. <head-list ref="headRef" @changeParent="changeAnswer"></head-list>
  951. <ProductionVersion
  952. ref="versionRefs"
  953. @changeProduct="changeProduct"
  954. ></ProductionVersion>
  955. <taskinstance-dialog
  956. ref="taskinstanceDialogRef"
  957. v-if="taskinstanceDialogFlag"
  958. @saveTaskInstance="saveTaskInstance"
  959. :visible.sync="taskinstanceDialogFlag"
  960. ></taskinstance-dialog>
  961. <timeDialog
  962. @chooseTime="chooseTime"
  963. ref="timeDialogRef"
  964. :isBatch="true"
  965. ></timeDialog>
  966. <selectStockLedgerDialog
  967. ref="selectStockLedgerDialogRef"
  968. @changeParent="replaceTable"
  969. :isSupplier="isSupplier"
  970. :showSaleCount="showSaleCount"
  971. :show-stock-count="showStockCount"
  972. :cacheKeyUrl="cacheKeyUrl + 'saleOrders'"
  973. ></selectStockLedgerDialog>
  974. <commodityPriceListDialog
  975. ref="commodityPriceListDialogRef"
  976. @changeParent="changeParent"
  977. ></commodityPriceListDialog>
  978. </el-form>
  979. </template>
  980. <script>
  981. import { numberReg } from 'ele-admin';
  982. import productList from '@/BIZComponents/product-list.vue';
  983. import dictMixins from '@/mixins/dictMixins';
  984. import fileUpload from '@/components/upload/fileUpload';
  985. import headList from '@/BIZComponents/user-select/user-select.vue';
  986. import ProductionVersion from '@/components/ProductionVersion2/index.vue';
  987. import {
  988. getInventoryTotalAPI,
  989. buildInventoryTotalQueryKey,
  990. matchInventoryTotal
  991. } from '@/api/wms';
  992. import { pricingWayList, lbjtList } from '@/enum/dict.js';
  993. import {
  994. changeCount,
  995. getAllPrice,
  996. getAllDiscountPrice,
  997. formatPrice,
  998. getAllQuantity
  999. } from '@/BIZComponents/setProduct.js';
  1000. import { contactQueryByCategoryIdsAPI } from '@/api/saleManage/contact';
  1001. import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
  1002. import timeDialog from '@/components/timeDialog/index.vue';
  1003. import { copyObj } from '@/utils/util';
  1004. import selectStockLedgerDialog from '@/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue'; //库存台账
  1005. import setAllValue from '@/BIZComponents/setAllValue.vue'; //批量修改
  1006. import tabMixins from '@/mixins/tableColumnsMixin';
  1007. import commodityPriceListDialog from '@/views/commodityManagement/commodityPriceList/components/commodityPriceListDialog.vue';
  1008. const dayjs = require('dayjs');
  1009. import { levelList, quoteTypeOp } from '@/enum/dict.js';
  1010. import {
  1011. getGoodsPriceByCondition,
  1012. getGoodsByCategoryId
  1013. } from '@/api/goodsManage/index';
  1014. import { parameterGetByCode } from '@/api/main/index.js';
  1015. import { getSummaries } from '@/utils/util.js';
  1016. export default {
  1017. mixins: [dictMixins, tabMixins],
  1018. components: {
  1019. fileUpload,
  1020. productList,
  1021. headList,
  1022. ProductionVersion,
  1023. taskinstanceDialog,
  1024. timeDialog,
  1025. selectStockLedgerDialog,
  1026. commodityPriceListDialog,
  1027. setAllValue
  1028. },
  1029. props: {
  1030. pageName: {
  1031. default: '',
  1032. type: String
  1033. },
  1034. isDiscountTotalPrice: {
  1035. default: false,
  1036. type: Boolean
  1037. },
  1038. quoteType: {
  1039. type: Number,
  1040. default: 1
  1041. },
  1042. isGuaranteePeriod: {
  1043. default: true,
  1044. type: Boolean
  1045. },
  1046. customerMark: {
  1047. default: '',
  1048. type: String
  1049. },
  1050. isContractId: {
  1051. type: Boolean,
  1052. default: false
  1053. },
  1054. isSinglePrice: {
  1055. //单价必填
  1056. type: Boolean,
  1057. default: true
  1058. },
  1059. isTotalCount: {
  1060. //数量必填
  1061. type: Boolean,
  1062. default: true
  1063. },
  1064. isCustomerMark: {
  1065. //客户代号必填
  1066. type: Boolean,
  1067. default: false
  1068. },
  1069. isDiscount: {
  1070. //折让
  1071. type: Boolean,
  1072. default: true
  1073. },
  1074. isProduceDeliveryDeadline: {
  1075. //生产交付交期必填
  1076. type: Boolean,
  1077. default: false
  1078. },
  1079. isDrawer: {
  1080. type: Boolean,
  1081. default: false
  1082. },
  1083. isChangeCount: {
  1084. //默认计算
  1085. type: Boolean,
  1086. default: true
  1087. },
  1088. // 是否合同
  1089. isContractBook: {
  1090. type: Boolean,
  1091. default: false
  1092. },
  1093. contractBookType: {
  1094. //合同类型 1销售 2采购
  1095. type: [String, Number],
  1096. default: 1
  1097. },
  1098. isTemporary: {
  1099. //临时
  1100. type: Boolean,
  1101. default: false
  1102. },
  1103. isSupplier: {
  1104. //供应商
  1105. type: Boolean,
  1106. default: false
  1107. },
  1108. isSalesRecord: {
  1109. default: ''
  1110. },
  1111. isArrivalWay: {
  1112. //分批到货时间
  1113. type: Boolean,
  1114. default: false
  1115. },
  1116. //订单类型
  1117. needProduce: {
  1118. type: [String, Number],
  1119. default: 1
  1120. },
  1121. cacheKeyUrl: '',
  1122. //是否显示订单编码
  1123. isOrderNo: {
  1124. type: Boolean,
  1125. default: false
  1126. },
  1127. isBatchNo: {
  1128. type: Boolean, //批次号是否必填
  1129. default: false
  1130. },
  1131. orderOption: {
  1132. default: () => {
  1133. return [];
  1134. }
  1135. },
  1136. //是否商品
  1137. isGoods: {
  1138. type: Boolean,
  1139. default: false
  1140. },
  1141. // 是否税率必填
  1142. isTaxRate: {
  1143. type: [Number, String],
  1144. default: 0
  1145. },
  1146. defTaxRate: {
  1147. type: Number,
  1148. default: undefined
  1149. },
  1150. //是否显示增重重量
  1151. isIncreaseTotalWeight: {
  1152. type: Boolean,
  1153. default: false
  1154. },
  1155. countObj: {
  1156. type: Object,
  1157. default: () => {
  1158. return {
  1159. countKey: 'saleCount',
  1160. unitKey: 'saleUnit',
  1161. unitIdKey: 'saleUnitId'
  1162. };
  1163. }
  1164. },
  1165. showSummary: {
  1166. type: Boolean,
  1167. default: false
  1168. },
  1169. // 是否显示排序字段
  1170. showSortLine: {
  1171. type: Boolean,
  1172. default: false
  1173. },
  1174. // 是否显示库存式订单可填订单数量
  1175. showSaleCount: {
  1176. type: Boolean,
  1177. default: false
  1178. },
  1179. // 是否同时显示库存数量和可用数量
  1180. showStockCount: {
  1181. type: Boolean,
  1182. default: false
  1183. }
  1184. },
  1185. data() {
  1186. const defaultForm = {
  1187. key: null,
  1188. endTime: '',
  1189. isFirst: 0,
  1190. name: '',
  1191. startTime: '',
  1192. workHour: '',
  1193. guaranteePeriodUnitCode: '',
  1194. technicalDrawings: [],
  1195. arrivalWay: 1,
  1196. // 生产加工类型特有字段
  1197. thickNess: '',
  1198. squareNumber: '',
  1199. processingFeeBeforeTax: '',
  1200. packagingFeeNotTaxed: '',
  1201. transportationFeeWithoutTax: '',
  1202. extraTax: '',
  1203. quotationSubtotalTax: '',
  1204. // 新增未税小记字段
  1205. quotationSubtotalBeforeTax: '',
  1206. quoteWay: 1,
  1207. discountRatio: 100
  1208. };
  1209. return {
  1210. levelList,
  1211. taskinstanceDialogFlag: false,
  1212. allPrice: 0,
  1213. allQuantity: 0,
  1214. numberReg,
  1215. defaultForm,
  1216. form: {
  1217. datasource: [],
  1218. discountTotalPrice: 0
  1219. },
  1220. isDate: 1,
  1221. pricingWayList,
  1222. curIndex: '',
  1223. rules: {},
  1224. dictList: {},
  1225. arrivalWayList: [
  1226. { label: '一次性到货', value: 1 },
  1227. { label: '分批到货', value: 2 }
  1228. ],
  1229. columnsVersion: 1,
  1230. selection: [],
  1231. quoteTypeOp,
  1232. widthsVersion: 0
  1233. };
  1234. },
  1235. computed: {
  1236. canHandl() {
  1237. return this.form.datasource.length;
  1238. },
  1239. columns() {
  1240. // 强制重新计算(每次进入时读取缓存宽度)
  1241. this.widthsVersion;
  1242. let columnsVersion = this.columnsVersion;
  1243. const cacheWidths = this.getStorage(this.cacheKeyUrl + 'Widths') || {};
  1244. const applyWidth = (col) => {
  1245. if (col.prop && cacheWidths[col.prop]) {
  1246. return { ...col, width: cacheWidths[col.prop], minWidth: undefined };
  1247. }
  1248. return col;
  1249. };
  1250. // 基础列定义
  1251. let baseColumns = [
  1252. {
  1253. label: '选择',
  1254. width: 45,
  1255. type: 'selection',
  1256. columnKey: 'selection',
  1257. align: 'center',
  1258. fixed: 'left'
  1259. },
  1260. {
  1261. width: 65,
  1262. type: 'index',
  1263. columnKey: 'index',
  1264. align: 'center',
  1265. fixed: 'left'
  1266. },
  1267. {
  1268. minWidth: 100,
  1269. prop: 'sortCode',
  1270. slot: 'sortCode',
  1271. label: '排序',
  1272. isNone: !this.showSortLine,
  1273. showOverflowTooltip: true,
  1274. align: 'center'
  1275. },
  1276. {
  1277. minWidth: 200,
  1278. prop: 'orderNo',
  1279. slot: 'orderNo',
  1280. label: '订单编码',
  1281. isNone: !this.isOrderNo,
  1282. showOverflowTooltip: true,
  1283. align: 'center'
  1284. },
  1285. {
  1286. width: 280,
  1287. prop: 'productName',
  1288. label: '名称',
  1289. slot: 'productName',
  1290. headerSlot: 'headerProductName',
  1291. align: 'center'
  1292. },
  1293. {
  1294. width: 120,
  1295. prop: 'productCode',
  1296. label: '编码',
  1297. slot: 'productCode',
  1298. align: 'center'
  1299. },
  1300. {
  1301. width: 120,
  1302. prop: 'specification',
  1303. label: '规格',
  1304. slot: 'specification',
  1305. align: 'center'
  1306. },
  1307. {
  1308. minWidth: 240,
  1309. prop: 'taskName',
  1310. label: '工序',
  1311. slot: 'taskName',
  1312. align: 'center'
  1313. },
  1314. {
  1315. minWidth: 120,
  1316. prop: 'entrustedEnterpriseId',
  1317. label: '受托企业',
  1318. slot: 'entrustedEnterpriseId',
  1319. // isNone: !this.isCustomerMark,
  1320. align: 'center'
  1321. },
  1322. {
  1323. width: 140,
  1324. prop: 'pricingWay',
  1325. label: '计价方式',
  1326. headerSlot: 'headerPricingWay',
  1327. slot: 'pricingWay',
  1328. isNone: this.quoteType === 2,
  1329. fixed: 'left',
  1330. align: 'center'
  1331. },
  1332. {
  1333. width: 250,
  1334. prop: 'saleCount',
  1335. label: '数量',
  1336. slot: 'saleCount',
  1337. headerSlot: this.isTotalCount ? 'headerTotalCount' : '',
  1338. align: 'center'
  1339. },
  1340. {
  1341. width: 250,
  1342. prop: 'quoteWay',
  1343. label: '报价方式',
  1344. slot: 'quoteWay',
  1345. headerSlot: 'headerQuoteWay',
  1346. align: 'center'
  1347. }
  1348. ];
  1349. // 当quoteType为2时添加生产加工相关列
  1350. if (this.quoteType === 2) {
  1351. baseColumns.push(
  1352. {
  1353. width: 150,
  1354. prop: 'thickNess',
  1355. label: '厚度',
  1356. slot: 'thickNess',
  1357. align: 'center'
  1358. },
  1359. {
  1360. width: 150,
  1361. prop: 'squareNumber',
  1362. label: '平方数',
  1363. slot: 'squareNumber',
  1364. align: 'center'
  1365. },
  1366. {
  1367. width: 150,
  1368. prop: 'processingFeeBeforeTax',
  1369. label: '加工费(未税)',
  1370. slot: 'processingFeeBeforeTax',
  1371. align: 'center'
  1372. },
  1373. {
  1374. width: 150,
  1375. prop: 'packagingFeeNotTaxed',
  1376. label: '包装费(未税)',
  1377. slot: 'packagingFeeNotTaxed',
  1378. align: 'center'
  1379. },
  1380. {
  1381. width: 150,
  1382. prop: 'transportationFeeWithoutTax',
  1383. label: '运输费(未税)',
  1384. slot: 'transportationFeeWithoutTax',
  1385. align: 'center'
  1386. },
  1387. {
  1388. width: 150,
  1389. prop: 'quotationSubtotalBeforeTax',
  1390. label: '未税小计',
  1391. slot: 'additionalTaxRate_untaxed',
  1392. align: 'center'
  1393. },
  1394. {
  1395. width: 150,
  1396. prop: 'extraTax',
  1397. label: '税率(%)',
  1398. slot: 'extraTax',
  1399. align: 'center'
  1400. },
  1401. {
  1402. width: 150,
  1403. prop: 'quotationSubtotalTax',
  1404. label: '含税小计',
  1405. slot: 'quotationSubtotalTax',
  1406. align: 'center'
  1407. }
  1408. );
  1409. }
  1410. // 其他列
  1411. const otherColumns = [
  1412. {
  1413. width: 160,
  1414. prop: 'customerExpectDeliveryDeadline',
  1415. label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
  1416. slot: 'customerExpectDeliveryDeadline',
  1417. headerSlot:
  1418. this.isDate == 1 && this.quoteType != 2
  1419. ? 'headerCustomerExpectDeliveryDeadline'
  1420. : '',
  1421. align: 'center'
  1422. },
  1423. {
  1424. width: 180,
  1425. prop: 'singleWeight',
  1426. label: '单重',
  1427. slot: 'singleWeight',
  1428. headerSlot: 'headerSingleWeight',
  1429. align: 'center'
  1430. },
  1431. {
  1432. minWidth: 120,
  1433. prop: 'goodsLevel',
  1434. label: '物品级别',
  1435. slot: 'goodsLevel',
  1436. align: 'center',
  1437. isNone: this.quoteType === 2
  1438. },
  1439. {
  1440. width: 200,
  1441. prop: 'totalCount',
  1442. label: '计量数量',
  1443. headerSlot: 'headerTotalCount',
  1444. align: 'center',
  1445. formatter: (_row, _column, cellValue) => {
  1446. if (_row.totalCount) {
  1447. return _row.totalCount + ' ' + (_row.measuringUnit || '');
  1448. }
  1449. },
  1450. isNone: this.quoteType === 2
  1451. },
  1452. {
  1453. width: 200,
  1454. prop: 'customerMark',
  1455. label: this.contractBookType == 1 ? '客户代号' : '供应商代号',
  1456. slot: 'customerMark',
  1457. headerSlot: this.isCustomerMark ? 'headerCustomerMark' : '',
  1458. align: 'center',
  1459. isNone: this.quoteType === 2
  1460. },
  1461. {
  1462. minWidth: 160,
  1463. prop: 'productionCodes',
  1464. label: '生产编号',
  1465. align: 'center',
  1466. isNone: this.quoteType === 2
  1467. },
  1468. {
  1469. minWidth: 280,
  1470. prop: 'productionRequirements',
  1471. label: '生产要求',
  1472. align: 'center',
  1473. slot: 'productionRequirements',
  1474. isNone: !this.isProductionRequirements && this.quoteType === 2
  1475. },
  1476. {
  1477. minWidth: 280,
  1478. prop: 'cuttingLength',
  1479. label: '裁线米段',
  1480. align: 'center',
  1481. slot: 'cuttingLength',
  1482. isNone: this.quoteType === 2
  1483. },
  1484. {
  1485. width: 200,
  1486. prop: 'productCategoryName',
  1487. label: '类型',
  1488. slot: 'productCategoryName',
  1489. align: 'center',
  1490. isNone: this.quoteType === 2
  1491. },
  1492. {
  1493. width: 120,
  1494. prop: 'packingSpecification',
  1495. align: 'center',
  1496. label: '包装规格',
  1497. showOverflowTooltip: true,
  1498. isNone: this.quoteType === 2
  1499. },
  1500. {
  1501. width: 160,
  1502. prop: 'goodsPriceType',
  1503. label: '价格类型',
  1504. slot: 'goodsPriceType',
  1505. align: 'center',
  1506. isNone: this.quoteType === 2
  1507. },
  1508. {
  1509. width: 200,
  1510. prop: 'singlePrice',
  1511. label: '单价',
  1512. slot: 'singlePrice',
  1513. headerSlot: this.isSinglePrice ? 'headerSinglePrice' : '',
  1514. align: 'center',
  1515. isNone: this.quoteType === 2
  1516. },
  1517. {
  1518. width: 160,
  1519. prop: 'taxRate',
  1520. label: '税率',
  1521. slot: 'taxRate',
  1522. align: 'center',
  1523. headerSlot: this.isTaxRate == 1 ? 'headerTaxRate' : '',
  1524. isNone: this.quoteType === 2
  1525. },
  1526. {
  1527. width: 180,
  1528. prop: 'notaxSinglePrice',
  1529. label: '不含税单价',
  1530. slot: 'notaxSinglePrice',
  1531. align: 'center',
  1532. isNone: this.quoteType === 2
  1533. },
  1534. {
  1535. width: 160,
  1536. prop: 'discountRatio',
  1537. label: '折让比例',
  1538. align: 'center',
  1539. isNone: !this.isDiscount,
  1540. slot: 'discountRatio',
  1541. headerSlot: 'headerDiscountRatio'
  1542. },
  1543. {
  1544. width: 160,
  1545. prop: 'discountSinglePrice',
  1546. label: '折让单价',
  1547. align: 'center',
  1548. isNone: !this.isDiscount,
  1549. formatter: (_row, _column, cellValue) => {
  1550. return _row.discountSinglePrice
  1551. ? formatPrice(Number(_row.discountSinglePrice))
  1552. : '';
  1553. }
  1554. },
  1555. {
  1556. width: 120,
  1557. prop: 'totalPrice',
  1558. label: '合计',
  1559. slot: 'totalPrice',
  1560. align: 'center'
  1561. },
  1562. {
  1563. width: 160,
  1564. prop: 'discountTotalPrice',
  1565. label: '折让合计',
  1566. align: 'center',
  1567. isNone: !this.isDiscount,
  1568. formatter: (_row, _column, cellValue) => {
  1569. return _row.discountTotalPrice
  1570. ? formatPrice(Number(_row.discountTotalPrice))
  1571. : '';
  1572. }
  1573. },
  1574. {
  1575. width: 110,
  1576. prop: 'batchNo',
  1577. label: '批次号',
  1578. slot: 'batchNo',
  1579. headerSlot: this.isBatchNo ? 'headerBatchNo' : '',
  1580. align: 'center',
  1581. isNone: this.quoteType === 2
  1582. },
  1583. {
  1584. minWidth: 180,
  1585. prop: 'systemBatchNo',
  1586. label: '系统内部批次号',
  1587. align: 'center',
  1588. isNone: this.quoteType === 2,
  1589. formatter: (row) => row.systemBatchNo || '-'
  1590. },
  1591. {
  1592. width: 120,
  1593. prop: 'warehouseName',
  1594. label: '仓库名称',
  1595. slot: 'warehouseName',
  1596. align: 'center',
  1597. isNone: this.quoteType === 2
  1598. },
  1599. {
  1600. width: 120,
  1601. prop: 'stockCountBase',
  1602. label: '库存数量',
  1603. align: 'center',
  1604. isNone: this.quoteType === 2 || !this.showStockCount
  1605. },
  1606. {
  1607. width: 120,
  1608. prop: 'availableCountBase',
  1609. label: this.showStockCount ? '可用数量' : '库存数量',
  1610. slot: 'availableCountBase',
  1611. align: 'center',
  1612. isNone: this.quoteType === 2
  1613. },
  1614. {
  1615. prop: 'provenance',
  1616. label: '产地',
  1617. slot: 'provenance',
  1618. align: 'center',
  1619. showOverflowTooltip: true,
  1620. minWidth: 200,
  1621. isNone: this.quoteType === 2
  1622. },
  1623. {
  1624. width: 180,
  1625. prop: 'totalWeight',
  1626. label: '总重',
  1627. slot: 'totalWeight',
  1628. formatter: (_row, _column, cellValue) => {
  1629. if (_row.totalWeight) {
  1630. return _row.totalWeight + ' ' + (_row.weightUnit || '');
  1631. }
  1632. },
  1633. align: 'center'
  1634. },
  1635. {
  1636. width: 180,
  1637. prop: 'increaseTotalWeight',
  1638. label: '增重重量',
  1639. slot: 'increaseTotalWeight',
  1640. isNone: this.quoteType === 2 || !this.isIncreaseTotalWeight,
  1641. align: 'center'
  1642. },
  1643. {
  1644. width: 160,
  1645. prop: 'productBrand',
  1646. label: '牌号',
  1647. slot: 'productBrand',
  1648. align: 'center',
  1649. isNone: this.quoteType === 2
  1650. },
  1651. {
  1652. width: 120,
  1653. prop: 'modelType',
  1654. label: '型号',
  1655. slot: 'modelType',
  1656. align: 'center',
  1657. isNone: this.quoteType === 2
  1658. },
  1659. {
  1660. width: 160,
  1661. prop: 'modelKey',
  1662. label: '机型',
  1663. slot: 'modelKey',
  1664. align: 'center',
  1665. isNone: this.quoteType === 2
  1666. },
  1667. {
  1668. width: 160,
  1669. prop: 'colorKey',
  1670. label: '颜色',
  1671. slot: 'colorKey',
  1672. align: 'center',
  1673. isNone: this.quoteType === 2
  1674. },
  1675. {
  1676. width: 120,
  1677. prop: 'produceType',
  1678. align: 'center',
  1679. label: '属性类型',
  1680. isNone: this.quoteType === 2,
  1681. showOverflowTooltip: true,
  1682. formatter: (row, column) => {
  1683. if (row.produceType) {
  1684. return row.produceType
  1685. .map((item) => {
  1686. return lbjtList[item];
  1687. })
  1688. .toString();
  1689. }
  1690. }
  1691. },
  1692. {
  1693. width: 160,
  1694. prop: 'arrivalWay',
  1695. label: '到货方式',
  1696. slot: 'arrivalWay',
  1697. align: 'center',
  1698. isNone: !this.isArrivalWay || this.quoteType === 2
  1699. },
  1700. {
  1701. width: 160,
  1702. prop: 'produceDeliveryDeadline',
  1703. label: '生产交付交期',
  1704. slot: 'produceDeliveryDeadline',
  1705. headerSlot:
  1706. this.isDate == 1 && this.isProduceDeliveryDeadline
  1707. ? 'headerProduceDeliveryDeadline'
  1708. : '',
  1709. isNone: this.contractBookType != 1,
  1710. align: 'center'
  1711. },
  1712. {
  1713. width: 200,
  1714. prop: 'guaranteePeriod',
  1715. label: '有效期',
  1716. slot: 'guaranteePeriod',
  1717. align: 'center',
  1718. isNone: this.quoteType === 2
  1719. },
  1720. {
  1721. width: 200,
  1722. prop: 'guaranteePeriodDeadline',
  1723. label: '有效期截止日期',
  1724. slot: 'guaranteePeriodDeadline',
  1725. isNone: !this.isGuaranteePeriod || this.quoteType === 2,
  1726. align: 'center'
  1727. },
  1728. {
  1729. width: 120,
  1730. prop: 'imgCode',
  1731. align: 'center',
  1732. label: '图号/件号',
  1733. showOverflowTooltip: true,
  1734. isNone: this.quoteType === 2
  1735. },
  1736. {
  1737. width: 220,
  1738. prop: 'customerReqFiles',
  1739. label: '客户需求',
  1740. slot: 'customerReqFiles',
  1741. align: 'center',
  1742. isNone: this.quoteType === 2
  1743. },
  1744. {
  1745. width: 130,
  1746. prop: 'technicalAnswerName',
  1747. label: '技术答疑人',
  1748. slot: 'technicalAnswerName',
  1749. align: 'center',
  1750. isNone: this.quoteType === 2
  1751. },
  1752. {
  1753. width: 220,
  1754. prop: 'technicalParams',
  1755. label: '技术参数',
  1756. slot: 'technicalParams',
  1757. align: 'center',
  1758. isNone: this.quoteType === 2
  1759. },
  1760. {
  1761. width: 240,
  1762. prop: 'technicalDrawings',
  1763. label: '技术图纸',
  1764. slot: 'technicalDrawings',
  1765. align: 'center'
  1766. },
  1767. {
  1768. width: 120,
  1769. prop: 'drawingVersion',
  1770. label: '图纸版本',
  1771. align: 'center',
  1772. isNone: this.quoteType === 2
  1773. },
  1774. {
  1775. width: 240,
  1776. prop: 'technologyRouteName',
  1777. label: '工艺路线',
  1778. slot: 'technologyRouteName',
  1779. align: 'center',
  1780. isNone: this.quoteType === 2
  1781. },
  1782. {
  1783. width: 240,
  1784. prop: 'industryArtFiles',
  1785. label: '工艺附件',
  1786. slot: 'industryArtFiles',
  1787. align: 'center',
  1788. isNone: this.quoteType === 2
  1789. },
  1790. {
  1791. width: 240,
  1792. prop: 'otherFiles',
  1793. label: '其他附件',
  1794. slot: 'otherFiles',
  1795. align: 'center',
  1796. isNone: this.quoteType === 2
  1797. },
  1798. {
  1799. width: 220,
  1800. prop: 'remark',
  1801. label: '备注',
  1802. slot: 'remark',
  1803. align: 'center'
  1804. },
  1805. {
  1806. columnKey: 'action',
  1807. label: '操作',
  1808. width: 120,
  1809. align: 'center',
  1810. resizable: false,
  1811. slot: 'action',
  1812. fixed: 'right',
  1813. showOverflowTooltip: true
  1814. }
  1815. ].map(applyWidth);
  1816. // 合并所有列
  1817. return [...baseColumns, ...otherColumns].filter((item) => !item.isNone);
  1818. }
  1819. },
  1820. created() {
  1821. parameterGetByCode({
  1822. code: 'eom_inventoryTable_customerExpectDeliveryDeadline'
  1823. }).then((res) => {
  1824. if (res.value) {
  1825. this.isDate = res.value;
  1826. }
  1827. });
  1828. },
  1829. methods: {
  1830. formatPrice,
  1831. getSummaries(param) {
  1832. return getSummaries(param, ['saleCount'], ' ');
  1833. },
  1834. handleCountChange(row, index, weightType) {
  1835. // 数量变化时,若为生产加工类型,触发含税小计计算
  1836. if (this.quoteType === 2) {
  1837. this.calculateIncludingTaxPrice(row, index);
  1838. } else {
  1839. this.changeCount(row, index, weightType);
  1840. }
  1841. },
  1842. packingChange(item, index) {
  1843. this.$set(
  1844. this.form.datasource[index],
  1845. this.countObj.unitKey,
  1846. item.conversionUnit
  1847. );
  1848. this.handleCountChange(this.form.datasource[index], index);
  1849. },
  1850. openVersion(index) {
  1851. this.$refs.versionRefs.open(index);
  1852. },
  1853. //设置分批到货时间
  1854. handleMethod(row, index) {
  1855. this.$refs.timeDialogRef.open(row, index);
  1856. },
  1857. chooseTime({ arrivalBatch, index }) {
  1858. this.$set(
  1859. this.form.datasource[index],
  1860. 'arrivalBatch',
  1861. copyObj(arrivalBatch)
  1862. );
  1863. },
  1864. //工艺路线
  1865. changeProduct(data, index) {
  1866. this.$set(
  1867. this.form.datasource[index],
  1868. 'technologyRouteName',
  1869. data.name
  1870. );
  1871. this.$set(this.form.datasource[index], 'technologyRouteId', data.id);
  1872. },
  1873. handleTaskinstance(row, index) {
  1874. this.taskinstanceDialogFlag = true;
  1875. this.$nextTick(() => {
  1876. this.$refs.taskinstanceDialogRef.open(row, index);
  1877. });
  1878. },
  1879. saveTaskInstance(row = {}) {
  1880. this.$set(this.form.datasource[row.index], 'taskId', row.id);
  1881. this.$set(this.form.datasource[row.index], 'taskName', row.name);
  1882. this.$set(
  1883. this.form.datasource[row.index],
  1884. 'routingId',
  1885. row.produceRoutingId
  1886. );
  1887. },
  1888. async getSupplierObj(productList, queryName) {
  1889. try {
  1890. let categoryIds = productList
  1891. .filter((item) => item.productId)
  1892. .map((item) => item.productId);
  1893. if (categoryIds.length > 0) {
  1894. return await contactQueryByCategoryIdsAPI({
  1895. categoryIds
  1896. });
  1897. } else {
  1898. return Promise.resolve({});
  1899. }
  1900. } catch (e) {
  1901. return Promise.resolve({});
  1902. }
  1903. },
  1904. setDeliveryDays(row, index, type, isAll) {
  1905. if (isAll) {
  1906. this.form.datasource.forEach((item, i) => {
  1907. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1908. item.guaranteePeriodUnitCode
  1909. );
  1910. this.$set(
  1911. this.form.datasource[i],
  1912. 'guaranteePeriodDeadline',
  1913. guaranteePeriodUnitName != 'second'
  1914. ? this.setDay(
  1915. item.guaranteePeriod,
  1916. guaranteePeriodUnitName,
  1917. item
  1918. )
  1919. : ''
  1920. );
  1921. });
  1922. return;
  1923. }
  1924. if (type == 'guaranteePeriod') {
  1925. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1926. row.guaranteePeriodUnitCode
  1927. );
  1928. this.$set(
  1929. this.form.datasource[index],
  1930. 'guaranteePeriodDeadline',
  1931. guaranteePeriodUnitName != 'second'
  1932. ? this.setDay(row.guaranteePeriod, guaranteePeriodUnitName, row)
  1933. : ''
  1934. );
  1935. }
  1936. },
  1937. guaranteePeriodUnit(code) {
  1938. return code == 3
  1939. ? 'day'
  1940. : code == 4
  1941. ? 'month'
  1942. : code == 5
  1943. ? 'year'
  1944. : 'second';
  1945. },
  1946. setDay(addDay, dateType = 'day', item) {
  1947. let tiem =
  1948. this.contractBookType == 1
  1949. ? item.produceDeliveryDeadline
  1950. : item.customerExpectDeliveryDeadline;
  1951. return dayjs(tiem || new Date())
  1952. .add(addDay, dateType)
  1953. .format('YYYY-MM-DD');
  1954. },
  1955. // 兼容未返回 stockCountBase 的旧库存接口
  1956. getStockCount(item) {
  1957. if (item.stockCountBase !== undefined && item.stockCountBase !== null) {
  1958. return Number(item.stockCountBase);
  1959. }
  1960. if (
  1961. item.measureQuantity !== undefined &&
  1962. item.measureQuantity !== null
  1963. ) {
  1964. return Number(item.measureQuantity);
  1965. }
  1966. return Number(item.availableCountBase || 0);
  1967. },
  1968. // 可用数量统一按库存余额扣减锁库数量计算
  1969. getAvailableStockCount(item) {
  1970. const availableCount =
  1971. this.getStockCount(item) - Number(item.lockQuantity || 0);
  1972. return Number(availableCount.toFixed(4));
  1973. },
  1974. // 返回列表数据
  1975. getTableValue() {
  1976. let comitDatasource = copyObj(this.form.datasource);
  1977. if (comitDatasource.length === 0) return [];
  1978. comitDatasource.forEach((v) => {
  1979. if (v.guaranteePeriodUnitCode) {
  1980. v.guaranteePeriodUnitName = this.getDictValue(
  1981. '保质期单位',
  1982. v.guaranteePeriodUnitCode
  1983. );
  1984. }
  1985. if (v.modelKey) {
  1986. v.modelKey = v.modelKey;
  1987. }
  1988. if (v.colorKey) {
  1989. v.colorKey = v.colorKey;
  1990. }
  1991. v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
  1992. v.customerReqFiles = v.customerReqFiles || [];
  1993. v.industryArtFiles = v.industryArtFiles || [];
  1994. v.otherFiles = v.otherFiles || [];
  1995. });
  1996. console.log('comitDatasource~~~', comitDatasource);
  1997. return comitDatasource;
  1998. },
  1999. getPrice() {
  2000. return [this.allPrice, this.form.discountTotalPrice];
  2001. },
  2002. //改变数量
  2003. changeCount(row, index, weightType) {
  2004. if (!row) {
  2005. this.form.datasource = this.form.datasource.map((item, i) => {
  2006. return changeCount(item, this.countObj, false);
  2007. });
  2008. this.form.datasource.forEach((item, i) => {
  2009. this.setIncreaseTotalWeight(item, i);
  2010. });
  2011. } else {
  2012. const updatedRow = changeCount(row, this.countObj, false, weightType);
  2013. this.$set(this.form.datasource, index, updatedRow);
  2014. this.setIncreaseTotalWeight(row, index);
  2015. }
  2016. this.$nextTick(() => {
  2017. // 生产加工类型不需要计算不含税单价,但需要计算含税小计
  2018. this.getNotaxSinglePrice();
  2019. this.changeAll();
  2020. });
  2021. },
  2022. setIncreaseTotalWeight(row, index) {
  2023. if (row.pricingWay == 3) {
  2024. this.$set(
  2025. this.form.datasource[index],
  2026. 'totalPrice',
  2027. formatPrice((row.increaseTotalWeight || 0) * row.singlePrice)
  2028. );
  2029. this.changeAll();
  2030. }
  2031. },
  2032. // 计算含税小计(原含税单价逻辑)
  2033. calculateIncludingTaxPrice(row, index) {
  2034. if (!row) return;
  2035. // 计算未税小记
  2036. const quotationSubtotalBeforeTax =
  2037. (Number(row.processingFeeBeforeTax) || 0) +
  2038. (Number(row.packagingFeeNotTaxed) || 0) +
  2039. (Number(row.transportationFeeWithoutTax) || 0);
  2040. // 使用 $nextTick 确保响应式更新完成
  2041. // this.$nextTick(() => {
  2042. this.$set(
  2043. this.form.datasource[index],
  2044. 'quotationSubtotalBeforeTax',
  2045. quotationSubtotalBeforeTax.toFixed(2)
  2046. );
  2047. // 计算含税小计
  2048. const taxRate = (Number(row.extraTax) || 0) / 100;
  2049. const quotationSubtotalTax = quotationSubtotalBeforeTax * (1 + taxRate);
  2050. this.$set(
  2051. this.form.datasource[index],
  2052. 'quotationSubtotalTax',
  2053. quotationSubtotalTax.toFixed(2)
  2054. );
  2055. const quantity = Number(row[this.countObj.countKey]) || 1;
  2056. const totalPrice = quotationSubtotalTax * quantity;
  2057. this.$set(
  2058. this.form.datasource[index],
  2059. 'totalPrice',
  2060. formatPrice(totalPrice)
  2061. );
  2062. if (
  2063. row[this.countObj.unitKey] == row.weightUnit &&
  2064. row.pricingWay == 1
  2065. ) {
  2066. this.$set(this.form.datasource[index], 'totalWeight', quantity);
  2067. } else {
  2068. if (quantity && row.singleWeight) {
  2069. this.$set(
  2070. this.form.datasource[index],
  2071. 'totalWeight',
  2072. (quantity * row.singleWeight).toFixed(2)
  2073. );
  2074. }
  2075. }
  2076. this.changeAll();
  2077. // });
  2078. },
  2079. changeAll() {
  2080. console.log('changeAll', this.form.datasource);
  2081. this.allPrice = getAllPrice(this.form.datasource) || 0;
  2082. this.allQuantity =
  2083. getAllQuantity(this.form.datasource, this.countObj) || 0;
  2084. this.form.discountTotalPrice =
  2085. getAllDiscountPrice(this.form.datasource) || 0;
  2086. if (this.isDiscountTotalPrice) {
  2087. this.form.discountTotalPrice = this.form.discountTotalPrice;
  2088. this.$emit('setDiscountTotalPrice', this.form.discountTotalPrice);
  2089. }
  2090. this.$emit(
  2091. 'setCountAmount',
  2092. this.allPrice,
  2093. this.form.discountTotalPrice
  2094. );
  2095. },
  2096. setCustomerMark(customerMark) {
  2097. this.form.datasource.forEach((item) => {
  2098. item['customerMark'] = customerMark;
  2099. this.$forceUpdate();
  2100. });
  2101. },
  2102. // 计算折让单价,折让总价
  2103. getDiscountRatioPrice(row) {
  2104. this.form.datasource.forEach((item, index) => {
  2105. if (item.singlePrice && item.discountRatio) {
  2106. this.$set(
  2107. this.form.datasource[index],
  2108. 'discountSinglePrice',
  2109. formatPrice(item.singlePrice * (item.discountRatio / 100))
  2110. );
  2111. this.$set(
  2112. this.form.datasource[index],
  2113. 'discountTotalPrice',
  2114. formatPrice(item.totalPrice * (item.discountRatio / 100))
  2115. );
  2116. } else {
  2117. this.$set(this.form.datasource[index], 'discountSinglePrice', 0);
  2118. this.$set(this.form.datasource[index], 'discountTotalPrice', 0);
  2119. }
  2120. this.$set(
  2121. this.form,
  2122. 'discountTotalPrice',
  2123. this.form.datasource.reduce(
  2124. (acc, cur) => acc + Number(cur.discountTotalPrice || 0),
  2125. 0
  2126. )
  2127. );
  2128. this.changeAll();
  2129. });
  2130. },
  2131. //计算不含税单价
  2132. getNotaxSinglePrice() {
  2133. this.form.datasource.forEach((item, index) => {
  2134. if (item.singlePrice && item.taxRate) {
  2135. this.$set(
  2136. this.form.datasource[index],
  2137. 'notaxSinglePrice',
  2138. formatPrice(item.singlePrice / (1 + item.taxRate / 100))
  2139. );
  2140. } else {
  2141. this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
  2142. }
  2143. });
  2144. },
  2145. //设置优惠后总金额修改产品单价
  2146. discountInputByOrder(val) {
  2147. this.form.discountTotalPrice = val;
  2148. this.form.datasource.forEach((item, index) => {
  2149. this.$set(
  2150. this.form.datasource[index],
  2151. 'discountSinglePrice',
  2152. this.getDiscountSinglePrice(item)
  2153. );
  2154. this.$set(
  2155. this.form.datasource[index],
  2156. 'discountTotalPrice',
  2157. this.getDiscountTotalPrice(item)
  2158. );
  2159. this.$set(
  2160. this.form.datasource[index],
  2161. 'discountRatio',
  2162. this.getDiscountRatio(item)
  2163. );
  2164. });
  2165. this.$emit('setDiscountTotalPrice', val);
  2166. this.$forceUpdate();
  2167. this.$refs.table.reRenderTable();
  2168. },
  2169. //批量设置税率
  2170. setAllTaxRateChange({ key, value }) {
  2171. let indexS = this.selection.map((item) => item.key - 1);
  2172. indexS.forEach((i) => {
  2173. this.$set(this.form.datasource[i], key, value);
  2174. this.getNotaxSinglePrice();
  2175. });
  2176. },
  2177. setAllValueChange({ key, value }) {
  2178. let indexS = this.selection.map((item) => item.key - 1);
  2179. indexS.forEach((i) => {
  2180. this.$set(this.form.datasource[i], key, value);
  2181. this.setDeliveryDays(this.form.datasource[i], i, 'guaranteePeriod');
  2182. });
  2183. },
  2184. //获取折让单价
  2185. getDiscountSinglePrice(row) {
  2186. let num =
  2187. (Number(this.form.discountTotalPrice) / Number(this.allPrice)) *
  2188. Number(row.singlePrice);
  2189. return isNaN(num) ? '' : formatPrice(num);
  2190. },
  2191. //获取折让比例
  2192. getDiscountRatio(row) {
  2193. let num = 100;
  2194. // if(Number(row.discountRatio)) {
  2195. // num =
  2196. // ((Number(this.form.discountTotalPrice) / Number(this.allPrice)) * Number(row.discountRatio)).toFixed(2);
  2197. // console.log('折让比例', row.discountRatio, num, (Number(this.form.discountTotalPrice) / Number(this.allPrice)))
  2198. // } else {
  2199. num = (
  2200. (Number(this.form.discountTotalPrice) / Number(this.allPrice)) *
  2201. 100
  2202. ).toFixed(2);
  2203. // }
  2204. return isNaN(num) ? '' : num;
  2205. },
  2206. //获取折让合计
  2207. getDiscountTotalPrice(row) {
  2208. let num = 0;
  2209. num =
  2210. Number(row.discountSinglePrice) * Number(row[this.countObj.countKey]);
  2211. return isNaN(num) ? '' : formatPrice(num);
  2212. },
  2213. orderNoChange(row, item) {
  2214. row['orderId'] = item.orderId;
  2215. },
  2216. //修改回显
  2217. async putTableValue(data) {
  2218. let productList =
  2219. (data &&
  2220. (data.quoteProductList || data.productList || data.detailList)) ||
  2221. [];
  2222. if (productList) {
  2223. let supplierObj = await this.getSupplierObj(productList, 'productId');
  2224. productList.forEach((item, index) => {
  2225. item['key'] = index + 1;
  2226. if (item.modelKey) {
  2227. item.modelKey = item.modelKey;
  2228. }
  2229. if (item.colorKey) {
  2230. item.colorKey = item.colorKey;
  2231. }
  2232. item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode
  2233. ? item.guaranteePeriodUnitCode + ''
  2234. : '';
  2235. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  2236. item.guaranteePeriodUnitCode
  2237. );
  2238. if (item.guaranteePeriod && item.guaranteePeriodUnitCode) {
  2239. item['guaranteePeriodDeadline'] =
  2240. item['guaranteePeriodDeadline'] ||
  2241. guaranteePeriodUnitName != 'second'
  2242. ? this.setDay(
  2243. item.guaranteePeriod,
  2244. guaranteePeriodUnitName,
  2245. item
  2246. )
  2247. : '';
  2248. }
  2249. item.entrustedEnterpriseIdList = supplierObj[item.productId];
  2250. // if (supplierObj[item.productId]?.length === 1) {
  2251. // item.entrustedEnterpriseId = supplierObj[item.productId][0].id;
  2252. // }
  2253. // item.entrustedEnterpriseId = item.entrustedEnterpriseId || undefined;
  2254. this.$set(
  2255. item,
  2256. 'entrustedEnterpriseId',
  2257. item.entrustedEnterpriseId || ''
  2258. );
  2259. item['customerMark'] = item.customerMark || this.customerMark;
  2260. item['arrivalWay'] = item.arrivalWay || 1;
  2261. item.discountRatio = Number(item.discountRatio) || 100;
  2262. item.taxRate =
  2263. item.taxRate !== undefined && item.taxRate !== null
  2264. ? item.taxRate
  2265. : this.isContractBook
  2266. ? this.defTaxRate
  2267. : this.isTaxRate == 1
  2268. ? this.defTaxRate
  2269. : undefined;
  2270. item.quoteWay = item.quoteWay || 1;
  2271. });
  2272. this.form.datasource = productList;
  2273. let codeList = this.form.datasource
  2274. .filter((item) => item.productCode)
  2275. .map((item) => buildInventoryTotalQueryKey(item));
  2276. //获取仓库库存
  2277. let inventoryTotalList = await getInventoryTotalAPI(codeList);
  2278. this.form.datasource
  2279. .filter((item) => item.productCode)
  2280. .forEach((item, index) => {
  2281. let find =
  2282. inventoryTotalList.find((key) =>
  2283. matchInventoryTotal(item, key)
  2284. ) || {};
  2285. this.form.datasource;
  2286. if (this.showStockCount) {
  2287. this.$set(
  2288. this.form.datasource[index],
  2289. 'stockCountBase',
  2290. this.getStockCount(find)
  2291. );
  2292. }
  2293. this.$set(
  2294. this.form.datasource[index],
  2295. 'availableCountBase',
  2296. this.showStockCount
  2297. ? this.getAvailableStockCount(find)
  2298. : find.availableCountBase
  2299. );
  2300. });
  2301. if (this.isChangeCount) {
  2302. this.changeCount();
  2303. } else {
  2304. this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
  2305. this.allQuantity = getAllQuantity(
  2306. this.form.datasource,
  2307. this.countObj
  2308. );
  2309. }
  2310. if (this.isDiscountTotalPrice) {
  2311. this.form.discountTotalPrice =
  2312. data.payAmount || data?.contractVO?.discountTotalPrice;
  2313. }
  2314. this.$refs.table.reload();
  2315. }
  2316. },
  2317. //选择产品
  2318. handParent(row, index) {
  2319. let item = {
  2320. id: row?.productCode
  2321. };
  2322. if (row?.goodsId) {
  2323. this.handGoods(index);
  2324. return;
  2325. }
  2326. if (this.needProduce == 1 || this.needProduce == 2) {
  2327. this.$refs.productListRef.open(item, index);
  2328. } else {
  2329. this.$refs.selectStockLedgerDialogRef.open(item, index);
  2330. }
  2331. },
  2332. handGoods(index) {
  2333. this.$refs.commodityPriceListDialogRef.open(index);
  2334. },
  2335. //选择技术人回调
  2336. changeAnswer(obj, idx) {
  2337. this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
  2338. this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
  2339. },
  2340. handHead(row, index) {
  2341. let item = {
  2342. id: row.technicalAnswerId
  2343. };
  2344. this.$refs.headRef.open(item, index);
  2345. },
  2346. //选择产品回调
  2347. changeParent(obj, idx) {
  2348. obj.forEach((item, index) => {
  2349. let i = idx == -1 ? index : idx;
  2350. let row = JSON.parse(JSON.stringify(this.defaultForm));
  2351. row.key = this.form.datasource.length + 1;
  2352. let parasm = idx == -1 ? row : this.form.datasource[i];
  2353. this.$set(parasm, 'productId', item.id);
  2354. this.$set(parasm, 'categoryName', item.name);
  2355. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  2356. this.$set(parasm, 'productBrand', item.brandNum);
  2357. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  2358. this.$set(parasm, 'productCode', item.code);
  2359. this.$set(parasm, 'productName', item.name);
  2360. this.$set(parasm, 'modelType', item.modelType);
  2361. if (this.showStockCount) {
  2362. this.$set(parasm, 'stockCountBase', this.getStockCount(item));
  2363. }
  2364. this.$set(
  2365. parasm,
  2366. 'availableCountBase',
  2367. this.showStockCount
  2368. ? this.getAvailableStockCount(item)
  2369. : item.availableCountBase
  2370. );
  2371. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  2372. this.$set(parasm, 'specification', item.specification);
  2373. this.$set(parasm, 'weightUnit', item.weightUnit);
  2374. this.$set(parasm, 'singleWeight', item.netWeight);
  2375. this.$set(parasm, 'pricingWay', 1);
  2376. this.$set(parasm, 'goodsLevel', item.goodsLevel);
  2377. this.$set(parasm, 'guaranteePeriod', item.warrantyPeriod);
  2378. this.$set(
  2379. parasm,
  2380. 'customerExpectDeliveryDeadline',
  2381. dayjs(new Date()).format('YYYY-MM-DD')
  2382. );
  2383. // console.log('colorKey~~', item.colorKey);
  2384. this.$set(parasm, 'modelKey', item.modelKey?.split(',')?.[0] || '');
  2385. this.$set(parasm, 'colorKey', item.colorKey?.split(',')?.[0] || '');
  2386. this.$set(
  2387. parasm,
  2388. 'technologyRouteName',
  2389. item.technologyRouteName || ''
  2390. );
  2391. this.$set(parasm, 'technologyRouteId', item.technologyRouteId || '');
  2392. if (this.defTaxRate) {
  2393. this.$set(
  2394. parasm,
  2395. 'taxRate',
  2396. parasm.taxRate !== undefined && parasm.taxRate !== null
  2397. ? parasm.taxRate
  2398. : this.isContractBook
  2399. ? this.defTaxRate
  2400. : this.isTaxRate == 1
  2401. ? this.defTaxRate
  2402. : undefined
  2403. );
  2404. }
  2405. this.$set(
  2406. parasm,
  2407. 'guaranteePeriodUnitCode',
  2408. item.warrantyPeriodUnit ? item.warrantyPeriodUnit + '' : ''
  2409. );
  2410. if (item.warrantyPeriod && item.warrantyPeriodUnit) {
  2411. this.$set(
  2412. parasm,
  2413. 'guaranteePeriodDeadline',
  2414. this.setDay(
  2415. item.warrantyPeriod,
  2416. this.guaranteePeriodUnit(item.warrantyPeriodUnit),
  2417. {}
  2418. )
  2419. );
  2420. }
  2421. this.$set(
  2422. parasm,
  2423. 'packageDispositionList',
  2424. item.packageDispositionList
  2425. );
  2426. if (item.packageDispositionList?.length) {
  2427. this.$set(
  2428. parasm,
  2429. this.countObj.unitIdKey,
  2430. item.packageDispositionList[0].id
  2431. );
  2432. this.$set(
  2433. parasm,
  2434. this.countObj.unitKey,
  2435. item.packageDispositionList[0].conversionUnit
  2436. );
  2437. }
  2438. this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
  2439. this.$set(parasm, 'imgCode', item.imgCode);
  2440. this.$set(parasm, 'produceType', item.componentAttribute);
  2441. if (this.isOrderNo) {
  2442. this.$set(parasm, 'orderNo', this.orderOption[0]?.orderNo);
  2443. this.$set(parasm, 'orderId', this.orderOption[0]?.orderId);
  2444. }
  2445. if (this.isGoods && item.goodsId) {
  2446. this.$set(parasm, 'goodsId', item.goodsId);
  2447. this.$set(parasm, 'goodsPriceId', item.goodsPriceId);
  2448. this.$set(parasm, 'goodsPriceType', item.goodsPriceType);
  2449. this.$set(parasm, 'singlePrice', item.singlePrice);
  2450. this.$set(parasm, 'notaxSinglePrice', item.notaxSinglePrice);
  2451. this.$set(parasm, 'taxRate', item.taxRate);
  2452. this.$set(parasm, 'discountSinglePrice', item.singlePrice);
  2453. this.$set(parasm, 'totalCount', '');
  2454. this.$set(parasm, 'discountRatio', item.discountRatio);
  2455. this.$set(parasm, 'quoteWay', item.quoteWay || 1);
  2456. } else {
  2457. this.$set(parasm, 'singlePrice', parasm.singlePrice || 0);
  2458. this.$set(parasm, 'discountRatio', parasm.discountRatio || 100);
  2459. this.$set(parasm, 'quoteWay', parasm.quoteWay || 1);
  2460. }
  2461. // 初始化生产加工特有字段及未税小记
  2462. // 当quoteType为2时,数量默认设置为1
  2463. if (this.quoteType === 2) {
  2464. this.processSetValue(parasm);
  2465. }
  2466. if (this.isSupplier) {
  2467. this.$set(
  2468. parasm,
  2469. 'entrustedEnterpriseIdList',
  2470. item.entrustedEnterpriseIdList
  2471. );
  2472. this.$set(
  2473. parasm,
  2474. 'entrustedEnterpriseId',
  2475. item.entrustedEnterpriseId
  2476. );
  2477. }
  2478. this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
  2479. this.$set(
  2480. parasm,
  2481. 'packingSpecification',
  2482. item.extField.packingSpecification
  2483. );
  2484. this.$set(parasm, 'customerMark', this.customerMark);
  2485. if (item.purchaseOrigins?.length > 0) {
  2486. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  2487. }
  2488. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  2489. if (idx == -1) {
  2490. this.form.datasource.push(row);
  2491. }
  2492. });
  2493. console.log('changeParent~~~', this.form.datasource);
  2494. this.changeCount();
  2495. },
  2496. async replaceTable(obj, idx) {
  2497. console.log('replaceTable', obj, idx);
  2498. for (let index = 0; index < obj.length; index++) {
  2499. const item = obj[index];
  2500. let i = idx == -1 ? index : idx;
  2501. let row = JSON.parse(JSON.stringify(this.defaultForm));
  2502. row.key = this.form.datasource.length + 1;
  2503. let parasm = idx == -1 ? row : this.form.datasource[i];
  2504. this.$set(parasm, 'customerMark', this.customerMark);
  2505. this.$set(parasm, 'saleCount', item.saleCount);
  2506. this.$set(parasm, 'productId', item.productId);
  2507. this.$set(parasm, 'categoryName', item.productName);
  2508. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  2509. this.$set(parasm, 'productBrand', item.productBrand);
  2510. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  2511. this.$set(parasm, 'productCode', item.productCode);
  2512. this.$set(parasm, 'productName', item.productName);
  2513. this.$set(parasm, 'modelType', item.categoryModel);
  2514. this.$set(parasm, 'warehouseId', item.warehouseId);
  2515. this.$set(parasm, 'warehouseName', item.warehouseName);
  2516. if (this.showStockCount) {
  2517. this.$set(parasm, 'stockCountBase', this.getStockCount(item));
  2518. }
  2519. this.$set(
  2520. parasm,
  2521. 'availableCountBase',
  2522. this.showStockCount
  2523. ? this.getAvailableStockCount(item)
  2524. : item.measureQuantity
  2525. );
  2526. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  2527. this.$set(parasm, 'specification', item.specification);
  2528. this.$set(parasm, 'weightUnit', item.weightUnit);
  2529. this.$set(parasm, 'singleWeight', item.weight);
  2530. this.$set(parasm, 'pricingWay', 1);
  2531. this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
  2532. this.$set(parasm, 'batchNo', item.batchNo);
  2533. this.$set(parasm, 'systemBatchNo', item.systemBatchNo);
  2534. this.$set(parasm, 'imgCode', '');
  2535. this.$set(parasm, 'produceType', item.componentAttribute);
  2536. this.$set(parasm, 'reelSpecification', item.reelSpecification);
  2537. this.$set(
  2538. parasm,
  2539. 'taxRate',
  2540. item.taxRate !== undefined && item.taxRate !== null
  2541. ? item.taxRate
  2542. : this.isContractBook
  2543. ? this.defTaxRate
  2544. : this.isTaxRate == 1
  2545. ? this.defTaxRate
  2546. : undefined
  2547. );
  2548. let goodsData = await getGoodsByCategoryId(item.productId);
  2549. goodsData = goodsData.filter((item) => item.approvalStatus == 2);
  2550. if (goodsData?.length) {
  2551. let goodsPriceList = goodsData[0]?.goodsPriceList[0];
  2552. this.$set(parasm, 'goodsId', goodsData[0].id);
  2553. this.$set(parasm, 'goodsPriceId', goodsPriceList.id);
  2554. this.$set(parasm, 'goodsPriceType', goodsPriceList.priceType);
  2555. this.$set(parasm, 'singlePrice', goodsPriceList.unitPrice || 0);
  2556. this.$set(
  2557. parasm,
  2558. 'notaxSinglePrice',
  2559. goodsPriceList.excludeTaxPrice
  2560. );
  2561. this.$set(parasm, 'taxRate', goodsPriceList.taxRate);
  2562. this.$set(parasm, 'discountSinglePrice', goodsPriceList.unitPrice);
  2563. this.$set(parasm, 'totalCount', '');
  2564. } else {
  2565. this.$set(parasm, 'singlePrice', 0);
  2566. }
  2567. this.$set(parasm, 'modelKey', item.modelKey?.split(',')?.[0] || '');
  2568. this.$set(parasm, 'colorKey', item.colorKey?.split(',')?.[0] || '');
  2569. if (this.isSupplier) {
  2570. this.$set(
  2571. parasm,
  2572. 'entrustedEnterpriseIdList',
  2573. item.entrustedEnterpriseIdList
  2574. );
  2575. this.$set(
  2576. parasm,
  2577. 'entrustedEnterpriseId',
  2578. item.entrustedEnterpriseId
  2579. );
  2580. }
  2581. this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
  2582. this.$set(
  2583. parasm,
  2584. 'packingSpecification',
  2585. item.extField.packingSpecification
  2586. );
  2587. this.$set(
  2588. parasm,
  2589. 'packageDispositionList',
  2590. item.packageDispositionList
  2591. );
  2592. if (item.packageDispositionList?.length) {
  2593. this.$set(
  2594. parasm,
  2595. this.countObj.unitIdKey,
  2596. item.packageDispositionList[0].id
  2597. );
  2598. this.$set(
  2599. parasm,
  2600. this.countObj.unitKey,
  2601. item.packageDispositionList[0].conversionUnit
  2602. );
  2603. }
  2604. this.$set(parasm, 'customerMark', this.customerMark);
  2605. if (item.purchaseOrigins?.length > 0) {
  2606. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  2607. }
  2608. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  2609. // 初始化生产加工特有字段及未税小记
  2610. // 当quoteType为2时,数量默认设置为1
  2611. if (this.quoteType === 2) {
  2612. this.processSetValue(parasm);
  2613. }
  2614. if (idx == -1) {
  2615. this.form.datasource.push(row);
  2616. }
  2617. }
  2618. // console.log(this.form.datasource);
  2619. if (this.showSaleCount) {
  2620. this.changeCount();
  2621. }
  2622. },
  2623. remove(index) {
  2624. this.form.datasource.splice(index, 1);
  2625. this.setSort();
  2626. this.changeAll();
  2627. },
  2628. // 重新排序
  2629. setSort() {
  2630. this.form.datasource.forEach((n, index) => {
  2631. n.key = index + 1;
  2632. });
  2633. },
  2634. // 添加临时产品
  2635. handlAdd() {
  2636. let item = JSON.parse(JSON.stringify(this.defaultForm));
  2637. item.key = this.form.datasource.length + 1;
  2638. item.customerMark = this.customerMark;
  2639. item.customerExpectDeliveryDeadline = dayjs(new Date()).format(
  2640. 'YYYY-MM-DD'
  2641. );
  2642. // 初始化生产加工特有字段及未税小记
  2643. // 当quoteType为2时,数量默认设置为1
  2644. if (this.quoteType === 2) {
  2645. this.processSetValue(item);
  2646. }
  2647. this.form.datasource.push(item);
  2648. },
  2649. processSetValue(parasm) {
  2650. this.$set(parasm, this.countObj.countKey, 1);
  2651. this.$set(parasm, 'thickNess', '');
  2652. this.$set(parasm, 'squareNumber', '');
  2653. this.$set(parasm, 'processingFeeBeforeTax', '');
  2654. this.$set(parasm, 'packagingFeeNotTaxed', '');
  2655. this.$set(parasm, 'transportationFeeWithoutTax', '');
  2656. this.$set(parasm, 'extraTax', 13);
  2657. this.$set(parasm, 'quotationSubtotalBeforeTax', '0.00');
  2658. this.$set(parasm, 'quotationSubtotalTax', '');
  2659. },
  2660. validateForm(callback) {
  2661. this.$refs.form.validate((valid, obj) => {
  2662. if (obj) {
  2663. console.log('validateForm', obj);
  2664. let messages = Object.keys(obj).map((key) => obj[key][0]);
  2665. if (messages.length > 0) {
  2666. this.$message.warning(messages[0].message);
  2667. }
  2668. }
  2669. callback(valid);
  2670. });
  2671. },
  2672. goodsPriceTypeChange(row, index) {
  2673. if (row.goodsId) {
  2674. getGoodsPriceByCondition({
  2675. id: row.goodsId,
  2676. priceType: row.goodsPriceType
  2677. }).then((res) => {
  2678. if (res.id) {
  2679. this.$set(this.form.datasource[index], 'goodsPriceId', res.id);
  2680. this.$set(
  2681. this.form.datasource[index],
  2682. 'goodsPriceType',
  2683. res.priceType
  2684. );
  2685. this.$set(
  2686. this.form.datasource[index],
  2687. 'singlePrice',
  2688. res.unitPrice
  2689. );
  2690. this.$set(
  2691. this.form.datasource[index],
  2692. 'notaxSinglePrice',
  2693. res.excludeTaxPrice
  2694. );
  2695. this.$set(this.form.datasource[index], 'taxRate', res.taxRate);
  2696. this.$set(
  2697. this.form.datasource[index],
  2698. 'discountSinglePrice',
  2699. res.unitPrice
  2700. );
  2701. }
  2702. this.changeCount(row, index);
  2703. });
  2704. }
  2705. },
  2706. save() {
  2707. this.$emit('save');
  2708. },
  2709. // 列头拖拽结束 - 保存列宽到本地缓存
  2710. handleHeaderDragend(newWidth, oldWidth, column) {
  2711. if (!column.property) return;
  2712. const widths = this.getStorage(this.cacheKeyUrl + 'Widths') || {};
  2713. widths[column.property] = newWidth;
  2714. this.setStorage(this.cacheKeyUrl + 'Widths', widths);
  2715. }
  2716. }
  2717. };
  2718. </script>
  2719. <style lang="scss" scoped>
  2720. .headbox {
  2721. display: flex;
  2722. justify-content: space-between;
  2723. align-items: center;
  2724. .amount {
  2725. font-size: 14px;
  2726. font-weight: bold;
  2727. padding-right: 30px;
  2728. }
  2729. }
  2730. .time-form .el-form-item {
  2731. margin-bottom: 0 !important;
  2732. }
  2733. ::v-deep .period {
  2734. display: flex;
  2735. .borderleftnone {
  2736. .el-input--medium .el-input__inner {
  2737. border-top-right-radius: 0;
  2738. border-bottom-right-radius: 0;
  2739. }
  2740. }
  2741. .borderrightnone {
  2742. .el-input--medium .el-input__inner {
  2743. border-top-left-radius: 0;
  2744. border-bottom-left-radius: 0;
  2745. }
  2746. }
  2747. }
  2748. ::v-deep .time-form tbody > tr:hover > td {
  2749. background-color: transparent !important;
  2750. }
  2751. ::v-deep .time-form .el-table tr {
  2752. background-color: #ffffff;
  2753. }
  2754. .pricebox {
  2755. display: flex;
  2756. justify-content: flex-start;
  2757. align-items: center;
  2758. font-weight: bold;
  2759. }
  2760. :deep(.el-input-group__append) {
  2761. padding: 0;
  2762. }
  2763. </style>