inventoryTableOld.vue 77 KB

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