inventoryTable.vue 73 KB

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