inventoryTable.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583
  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. :toolkit="[]"
  8. :datasource="form.datasource"
  9. cache-key="systemRoleTable17"
  10. class="time-form"
  11. >
  12. <!-- 表头工具栏 -->
  13. <template v-slot:toolbar>
  14. <div class="headbox">
  15. <div>
  16. <!-- <el-button-->
  17. <!-- size="small"-->
  18. <!-- type="primary"-->
  19. <!-- icon="el-icon-plus"-->
  20. <!-- class="ele-btn-icon"-->
  21. <!-- @click="handlAdd"-->
  22. <!-- v-if="!isContractId"-->
  23. <!-- >-->
  24. <!-- 新增-->
  25. <!-- </el-button>-->
  26. <el-button
  27. size="small"
  28. type="primary"
  29. icon="el-icon-plus"
  30. class="ele-btn-icon"
  31. @click="handParent('', -1)"
  32. v-if="!isContractId"
  33. >
  34. 新增
  35. </el-button>
  36. </div>
  37. <div class="pricebox">
  38. <span class="amount">总计:{{ allPrice }}元</span>
  39. <el-form-item
  40. style="width: 300px"
  41. v-if="isDiscountTotalPrice"
  42. label="优惠后总金额:"
  43. prop="discountTotalPrice"
  44. :rules="{
  45. required: true,
  46. message: '请输入优惠后总金额',
  47. trigger: 'change'
  48. }"
  49. >
  50. <el-input
  51. type="number"
  52. :min="0"
  53. :max="allPrice"
  54. :disabled="!allPrice"
  55. v-model="form.discountTotalPrice"
  56. style="width: 180px"
  57. placeholder="请输入"
  58. @input="discountInputByOrder(form.discountTotalPrice)"
  59. >
  60. <template slot="append">元</template>
  61. </el-input>
  62. </el-form-item>
  63. </div>
  64. </div>
  65. </template>
  66. <template v-slot:productName="{ row, $index }">
  67. <el-form-item
  68. style="margin-bottom: 20px"
  69. :prop="'datasource.' + $index + '.productName'"
  70. :rules="{
  71. required: true,
  72. message: '请输入',
  73. trigger: 'change'
  74. }"
  75. >
  76. <el-input
  77. :disabled="!!row.productCode"
  78. v-model="row.productName"
  79. placeholder="请输入"
  80. style="width: 60%; margin-right: 10px"
  81. ></el-input>
  82. <el-button
  83. size="small"
  84. type="primary"
  85. @click.native="handParent(row, $index)"
  86. >选择
  87. </el-button>
  88. </el-form-item>
  89. </template>
  90. <template v-slot:headerCustomerMark="{ column }">
  91. <span class="is-required">{{ column.label }}</span>
  92. </template>
  93. <template v-slot:customerMark="{ row, $index }">
  94. <el-form-item :prop="'datasource.' + $index + '.customerMark'">
  95. <el-input v-model="row.customerMark" placeholder="请输入"></el-input>
  96. </el-form-item>
  97. </template>
  98. <template v-slot:headerProductName="{ column }">
  99. <span class="is-required">{{ column.label }}</span>
  100. </template>
  101. <template v-slot:productCode="scope">
  102. <el-form-item
  103. style="margin-bottom: 20px"
  104. :prop="'datasource.' + scope.$index + '.productCode'"
  105. >
  106. <el-input v-model="scope.row.productCode" :disabled="true"></el-input>
  107. </el-form-item>
  108. </template>
  109. <template v-slot:productCategoryName="scope">
  110. <el-form-item
  111. style="margin-bottom: 20px"
  112. :prop="'datasource.' + scope.$index + '.productCategoryName'"
  113. >
  114. <el-input v-model="scope.row.productCategoryName" disabled></el-input>
  115. </el-form-item>
  116. </template>
  117. <template v-slot:totalCount="scope">
  118. <el-form-item
  119. style="margin-bottom: 20px"
  120. :prop="'datasource.' + scope.$index + '.totalCount'"
  121. :rules="{
  122. required: isTotalCount ? true : false,
  123. message: '请输入单价',
  124. trigger: 'change'
  125. }"
  126. >
  127. <el-input
  128. v-model="scope.row.totalCount"
  129. type="number"
  130. placeholder="请输入"
  131. @input="changeCount(scope.row, scope.$index)"
  132. ></el-input>
  133. </el-form-item>
  134. </template>
  135. <template v-slot:headerTotalCount="{ column }">
  136. <span :class="{ 'is-required': isTotalCount }">{{ column.label }}</span>
  137. </template>
  138. <template v-slot:totalPrice="scope">
  139. <el-form-item
  140. style="margin-bottom: 20px"
  141. :prop="'datasource.' + scope.$index + '.totalPrice'"
  142. >
  143. {{ (Number(scope.row.totalPrice) || 0).toFixed(2) }}元
  144. </el-form-item>
  145. </template>
  146. <template v-slot:productBrand="scope">
  147. <el-form-item
  148. style="margin-bottom: 20px"
  149. :prop="'datasource.' + scope.$index + '.productBrand'"
  150. >
  151. <el-input
  152. v-model="scope.row.productBrand"
  153. :disabled="!!scope.row.productCode"
  154. ></el-input>
  155. </el-form-item>
  156. </template>
  157. <template v-slot:modelType="scope">
  158. <el-form-item
  159. style="margin-bottom: 20px"
  160. :prop="'datasource.' + scope.$index + '.modelType'"
  161. >
  162. <el-input
  163. v-model="scope.row.modelType"
  164. :disabled="!!scope.row.productCode"
  165. ></el-input>
  166. </el-form-item>
  167. </template>
  168. <template v-slot:specification="scope">
  169. <el-form-item
  170. style="margin-bottom: 20px"
  171. :prop="'datasource.' + scope.$index + '.specification'"
  172. >
  173. <el-input
  174. v-model="scope.row.specification"
  175. :disabled="!!scope.row.productCode"
  176. ></el-input>
  177. </el-form-item>
  178. </template>
  179. <template v-slot:guaranteePeriod="scope">
  180. <div class="period">
  181. <div class="borderleftnone">
  182. <el-form-item
  183. style="margin-bottom: 20px"
  184. :prop="'datasource.' + scope.$index + '.guaranteePeriod'"
  185. :rules="{
  186. pattern: numberReg,
  187. message: '请输入有效期',
  188. trigger: 'blur'
  189. }"
  190. >
  191. <el-input
  192. v-model="scope.row.guaranteePeriod"
  193. @change="
  194. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  195. "
  196. placeholder="请输入"
  197. ></el-input>
  198. </el-form-item>
  199. </div>
  200. <div class="borderrightnone">
  201. <DictSelection
  202. dictName="质保期单位"
  203. clearable
  204. v-model="scope.row.guaranteePeriodUnitCode"
  205. @change="
  206. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  207. "
  208. >
  209. </DictSelection>
  210. </div>
  211. </div>
  212. </template>
  213. <template v-slot:measuringUnit="scope">
  214. <el-form-item
  215. style="margin-bottom: 20px"
  216. :prop="'datasource.' + scope.$index + '.measuringUnit'"
  217. >
  218. <el-input
  219. v-model="scope.row.measuringUnit"
  220. :disabled="!!scope.row.productCode"
  221. placeholder="请输入"
  222. ></el-input>
  223. </el-form-item>
  224. </template>
  225. <template v-slot:remark="scope">
  226. <el-form-item
  227. style="margin-bottom: 20px"
  228. :prop="'datasource.' + scope.$index + '.remark'"
  229. >
  230. <el-input
  231. v-model="scope.row.remark"
  232. type="textarea"
  233. placeholder="请输入"
  234. ></el-input>
  235. </el-form-item>
  236. </template>
  237. <template v-slot:singlePrice="scope">
  238. <el-form-item
  239. style="margin-bottom: 20px"
  240. :prop="'datasource.' + scope.$index + '.singlePrice'"
  241. :rules="{
  242. required: isSinglePrice ? true : false,
  243. message: '请输入单价',
  244. trigger: 'change'
  245. }"
  246. >
  247. <el-input
  248. v-model="scope.row.singlePrice"
  249. placeholder="请输入"
  250. type="number"
  251. @input="changeCount(scope.row, scope.$index)"
  252. >
  253. <template slot="append">元</template>
  254. </el-input>
  255. </el-form-item>
  256. </template>
  257. <template v-slot:notaxSinglePrice="scope">
  258. <el-form-item
  259. style="margin-bottom: 20px"
  260. :prop="'datasource.' + scope.$index + '.notaxSinglePrice'"
  261. >
  262. <el-input
  263. v-model="scope.row.notaxSinglePrice"
  264. placeholder="请输入"
  265. type="number"
  266. >
  267. <template slot="append">元</template>
  268. </el-input>
  269. </el-form-item>
  270. </template>
  271. <template v-slot:taxRate="scope">
  272. <el-form-item
  273. style="margin-bottom: 20px"
  274. :prop="'datasource.' + scope.$index + '.taxRate'"
  275. >
  276. <el-input
  277. v-model="scope.row.taxRate"
  278. placeholder="请输入"
  279. type="number"
  280. @input="getNotaxSinglePrice"
  281. >
  282. <template slot="append">%</template>
  283. </el-input>
  284. </el-form-item>
  285. </template>
  286. <template v-slot:modelKey="scope">
  287. <el-form-item :prop="'datasource.' + scope.$index + '.' + 'modelKey'">
  288. <DictSelection
  289. dictName="物品机型"
  290. clearable
  291. v-model="scope.row.modelKey"
  292. :isOne="scope.$index === 0"
  293. :key="scope.$index + '物品机型'"
  294. multiple
  295. filterable
  296. allow-create
  297. default-first-option
  298. >
  299. </DictSelection>
  300. </el-form-item>
  301. </template>
  302. <template v-slot:colorKey="scope">
  303. <el-form-item :prop="'datasource.' + scope.$index + '.' + 'colorKey'">
  304. <DictSelection
  305. dictName="物品颜色"
  306. clearable
  307. v-model="scope.row.colorKey"
  308. :isOne="scope.$index === 0"
  309. multiple
  310. filterable
  311. allow-create
  312. default-first-option
  313. >
  314. </DictSelection>
  315. </el-form-item>
  316. </template>
  317. <template v-slot:headerSinglePrice="{ column }">
  318. <span :class="isSinglePrice ? 'is-required' : ''">{{
  319. column.label
  320. }}</span>
  321. </template>
  322. <template v-slot:headerCustomerExpectDeliveryDeadline="{ column }">
  323. <span :class="contractBookType == 1 ? 'is-required' : ''">{{
  324. column.label
  325. }}</span>
  326. </template>
  327. <template v-slot:technicalAnswerName="{ row, $index }">
  328. <el-form-item
  329. style="margin-bottom: 20px"
  330. :prop="'datasource.' + $index + '.technicalAnswerName'"
  331. >
  332. <el-input
  333. v-model="row.technicalAnswerName"
  334. placeholder="请输入"
  335. @click.native="handHead(row, $index)"
  336. ></el-input>
  337. </el-form-item>
  338. </template>
  339. <template v-slot:technicalParams="scope">
  340. <el-form-item
  341. style="margin-bottom: 20px"
  342. :prop="'datasource.' + scope.$index + '.technicalParams'"
  343. >
  344. <el-input
  345. type="textarea"
  346. v-model="scope.row.technicalParams"
  347. placeholder="请输入"
  348. ></el-input>
  349. </el-form-item>
  350. </template>
  351. <template v-slot:provenance="scope">
  352. <el-form-item :prop="'datasource.' + scope.$index + '.provenance'">
  353. <DictSelection
  354. dictName="产地"
  355. clearable
  356. v-model="scope.row.provenance"
  357. collapse-tags
  358. multiple
  359. >
  360. </DictSelection>
  361. </el-form-item>
  362. </template>
  363. <template v-slot:technicalDrawings="scope">
  364. <el-form-item
  365. style="margin-bottom: 20px"
  366. :prop="'datasource.' + scope.$index + '.technicalDrawings'"
  367. >
  368. <fileMain
  369. v-model="scope.row.technicalDrawings"
  370. :type="isContractId ? 'view' : ''"
  371. ></fileMain>
  372. </el-form-item>
  373. </template>
  374. <template v-slot:customerReqFiles="scope">
  375. <el-form-item
  376. style="margin-bottom: 20px"
  377. :prop="'datasource.' + scope.$index + '.customerReqFiles'"
  378. >
  379. <fileMain
  380. v-model="scope.row.customerReqFiles"
  381. :type="isContractId ? 'view' : ''"
  382. ></fileMain>
  383. </el-form-item>
  384. </template>
  385. <template v-slot:industryArtFiles="scope">
  386. <el-form-item
  387. style="margin-bottom: 20px"
  388. :prop="'datasource.' + scope.$index + '.industryArtFiles'"
  389. :rules="{
  390. required: false,
  391. message: '请输入',
  392. trigger: 'change'
  393. }"
  394. >
  395. <fileMain
  396. v-model="scope.row.industryArtFiles"
  397. :type="isContractId ? 'view' : ''"
  398. ></fileMain>
  399. </el-form-item>
  400. </template>
  401. <template v-slot:otherFiles="scope">
  402. <el-form-item
  403. style="margin-bottom: 20px"
  404. :prop="'datasource.' + scope.$index + '. otherFiles'"
  405. >
  406. <fileMain
  407. v-model="scope.row.otherFiles"
  408. :type="isContractId ? 'view' : ''"
  409. ></fileMain>
  410. </el-form-item>
  411. </template>
  412. <template v-slot:headerProduceDeliveryDeadline="{ column }">
  413. <span :class="isProduceDeliveryDeadline ? 'is-required' : ''">{{
  414. column.label
  415. }}</span>
  416. </template>
  417. <template v-slot:produceDeliveryDeadline="scope">
  418. <el-form-item
  419. :prop="'datasource.' + scope.$index + '.produceDeliveryDeadline'"
  420. :rules="{
  421. required: isProduceDeliveryDeadline ? true : false,
  422. message: '选择生产交付交期',
  423. trigger: 'change'
  424. }"
  425. >
  426. <el-date-picker
  427. style="width: 140px"
  428. v-model="scope.row.produceDeliveryDeadline"
  429. value-format="yyyy-MM-dd"
  430. @change="
  431. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  432. "
  433. type="date"
  434. placeholder="选择日期"
  435. >
  436. </el-date-picker>
  437. </el-form-item>
  438. </template>
  439. <template v-slot:customerExpectDeliveryDeadline="scope">
  440. <el-form-item
  441. :rules="{
  442. required: true,
  443. message:
  444. contractBookType == 1 ? '请选择客户期望交期' : '请选择交付日期',
  445. trigger: 'change'
  446. }"
  447. :prop="
  448. 'datasource.' + scope.$index + '.customerExpectDeliveryDeadline'
  449. "
  450. >
  451. <el-date-picker
  452. style="width: 140px"
  453. v-model="scope.row.customerExpectDeliveryDeadline"
  454. value-format="yyyy-MM-dd"
  455. @change="
  456. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  457. "
  458. type="date"
  459. placeholder="选择日期"
  460. >
  461. </el-date-picker>
  462. </el-form-item>
  463. </template>
  464. <template v-slot:guaranteePeriodDeadline="scope">
  465. <el-form-item
  466. :prop="'datasource.' + scope.$index + '.guaranteePeriodDeadline'"
  467. >
  468. <el-date-picker
  469. style="width: 140px"
  470. v-model="scope.row.guaranteePeriodDeadline"
  471. value-format="yyyy-MM-dd"
  472. type="date"
  473. placeholder="选择日期"
  474. >
  475. </el-date-picker>
  476. </el-form-item>
  477. </template>
  478. <template v-slot:singleWeight="scope">
  479. <el-form-item
  480. style="margin-bottom: 20px"
  481. :prop="'datasource.' + scope.$index + '.singleWeight'"
  482. >
  483. <el-input
  484. v-model="scope.row.singleWeight"
  485. @input="changeCount(scope.row, scope.$index)"
  486. placeholder="请输入"
  487. ></el-input>
  488. </el-form-item>
  489. </template>
  490. <template v-slot:technologyRouteName="scope">
  491. <el-form-item
  492. :prop="'datasource.' + scope.$index + '.technologyRouteName'"
  493. :rules="{
  494. required: false,
  495. message: '请选择',
  496. trigger: 'change'
  497. }"
  498. >
  499. <el-input
  500. v-model="scope.row.technologyRouteName"
  501. placeholder="请选择"
  502. @click.native="openVersion(scope.$index)"
  503. ></el-input>
  504. </el-form-item>
  505. </template>
  506. <template v-slot:pricingWay="scope">
  507. <el-form-item :prop="'datasource.' + scope.$index + '.pricingWay'">
  508. <el-select
  509. v-model="scope.row.pricingWay"
  510. placeholder="请选择"
  511. :rules="{
  512. required: true,
  513. message: '请选择计价方式',
  514. trigger: 'change'
  515. }"
  516. >
  517. <el-option
  518. v-for="item in pricingWayList"
  519. :key="item.id"
  520. :label="item.name"
  521. :value="item.id"
  522. @click.native="changeCount(scope.row, scope.$index)"
  523. >
  524. </el-option>
  525. </el-select>
  526. </el-form-item>
  527. </template>
  528. <template v-slot:orderNo="{ row, $index }">
  529. <el-form-item :prop="'datasource.' + $index + '.orderNo'">
  530. <el-select v-model="row.orderNo" style="width: 100%">
  531. <el-option
  532. :label="item.orderNo"
  533. :value="item.orderNo"
  534. @click.native="orderNoChange(row, item)"
  535. v-for="(item, index) in orderOption"
  536. :key="index"
  537. ></el-option>
  538. </el-select>
  539. </el-form-item>
  540. </template>
  541. <template v-slot:headerPricingWay="{ column }">
  542. <span class="is-required">{{ column.label }}</span>
  543. </template>
  544. <template v-slot:saleCount="scope">
  545. <el-form-item
  546. style="margin-bottom: 20px"
  547. :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
  548. :rules="{
  549. required: isTotalCount ? true : false,
  550. message: '请输入数量',
  551. trigger: 'change'
  552. }"
  553. >
  554. <el-input
  555. v-model="scope.row[countObj.countKey]"
  556. placeholder="请输入"
  557. type="number"
  558. :min="0"
  559. @input="changeCount(scope.row, scope.$index)"
  560. >
  561. </el-input>
  562. </el-form-item>
  563. </template>
  564. <template v-slot:saleUnit="scope">
  565. <el-form-item
  566. style="margin-bottom: 20px"
  567. :prop="'datasource.' + scope.$index + '.' + countObj.unitIdKey"
  568. >
  569. <el-select
  570. v-model="scope.row[countObj.unitIdKey]"
  571. style="width: 100%"
  572. @change="changeCount(scope.row, scope.$index)"
  573. >
  574. <el-option
  575. :label="item.conversionUnit"
  576. :value="item.id"
  577. @click.native="packingChange(item, scope.$index)"
  578. v-for="(item, index) in scope.row.packageDispositionList"
  579. :key="index"
  580. ></el-option>
  581. </el-select>
  582. </el-form-item>
  583. </template>
  584. <!-- 操作列 -->
  585. <template v-slot:action="scope">
  586. <el-popconfirm
  587. class="ele-action"
  588. title="确定要删除吗?"
  589. @confirm="remove(scope.$index)"
  590. >
  591. <template v-slot:reference>
  592. <el-link type="danger" :underline="false" icon="el-icon-delete">
  593. 删除
  594. </el-link>
  595. </template>
  596. </el-popconfirm>
  597. </template>
  598. </ele-pro-table>
  599. <product-list
  600. ref="productListRef"
  601. classType="1"
  602. :is-get-inventory-total="true"
  603. @changeParent="changeParent"
  604. ></product-list>
  605. <head-list ref="headRef" @changeParent="changeAnswer"></head-list>
  606. <ProductionVersion
  607. ref="versionRefs"
  608. @changeProduct="changeProduct"
  609. ></ProductionVersion>
  610. <!-- <taskinstance-dialog
  611. ref="taskinstanceDialogRef"
  612. v-if="taskinstanceDialogFlag"
  613. @saveTaskInstance="saveTaskInstance"
  614. :visible.sync="taskinstanceDialogFlag"
  615. ></taskinstance-dialog> -->
  616. </el-form>
  617. </template>
  618. <script>
  619. import { numberReg } from 'ele-admin';
  620. import productList from '@/BIZComponents/product-list.vue';
  621. import dictMixins from '@/mixins/dictMixins';
  622. import fileUpload from '@/components/upload/fileUpload';
  623. import headList from '@/BIZComponents/user-select/user-select.vue';
  624. import ProductionVersion from '@/components/ProductionVersion2/index.vue';
  625. import { getByCode } from '@/api/system/dictionary-data';
  626. // import fileMain from '@/components/addDoc/index.vue';
  627. import { pricingWayList, lbjtList } from '@/enum/dict.js';
  628. import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
  629. import { getInventoryTotalAPI } from '@/api/bpm/components/wms/index.js';
  630. import { copyObj } from '@/utils/util';
  631. // import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
  632. const dayjs = require('dayjs');
  633. export default {
  634. mixins: [dictMixins],
  635. components: {
  636. // fileMain,
  637. productList,
  638. fileUpload,
  639. headList,
  640. ProductionVersion
  641. },
  642. props: {
  643. pageName: {
  644. default: '',
  645. type: String
  646. },
  647. isDiscountTotalPrice: {
  648. default: false,
  649. type: Boolean
  650. },
  651. isGuaranteePeriod: {
  652. default: true,
  653. type: Boolean
  654. },
  655. isProduceDeliveryDeadline: {
  656. //生产交付交期必填
  657. type: Boolean,
  658. default: false
  659. },
  660. customerMark: {
  661. default: '',
  662. type: String
  663. },
  664. isContractId: {
  665. type: Boolean,
  666. default: false
  667. },
  668. isSinglePrice: {
  669. //单价必填
  670. type: Boolean,
  671. default: true
  672. },
  673. isTotalCount: {
  674. //数量必填
  675. type: Boolean,
  676. default: true
  677. },
  678. isDrawer: {
  679. type: Boolean,
  680. default: false
  681. },
  682. isChangeCount: {
  683. //默认计算
  684. type: Boolean,
  685. default: true
  686. },
  687. contractBookType: {
  688. //合同类型 1销售 2采购
  689. type: [String, Number],
  690. default: 1
  691. },
  692. isSupplierMark: {
  693. //客户代号必填
  694. type: Boolean,
  695. default: false
  696. },
  697. isTemporary: {
  698. //临时
  699. type: Boolean,
  700. default: false
  701. },
  702. isDiscount: {
  703. //折让
  704. type: Boolean,
  705. default: true
  706. },
  707. //是否显示订单编码
  708. isOrderNo: {
  709. type: Boolean,
  710. default: false
  711. },
  712. orderOption: {
  713. default: () => {
  714. return [];
  715. }
  716. },
  717. countObj: {
  718. type: Object,
  719. default: () => {
  720. return {
  721. countKey: 'saleCount',
  722. unitKey: 'saleUnit',
  723. unitIdKey: 'saleUnitId'
  724. };
  725. }
  726. }
  727. },
  728. data() {
  729. const defaultForm = {
  730. key: null,
  731. endTime: '',
  732. isFirst: 0,
  733. name: '',
  734. startTime: '',
  735. workHour: '',
  736. guaranteePeriodUnitCode: '',
  737. technicalDrawings: []
  738. };
  739. return {
  740. allPrice: 0,
  741. numberReg,
  742. defaultForm,
  743. form: {
  744. discountTotalPrice: 0,
  745. datasource: []
  746. },
  747. pricingWayList,
  748. rules: {},
  749. dictList: {}
  750. };
  751. },
  752. computed: {
  753. canHandl() {
  754. return this.form.datasource.length;
  755. },
  756. columns() {
  757. let orderColumn = {
  758. width: 1,
  759. show: false
  760. };
  761. if (this.isOrderNo) {
  762. orderColumn = {
  763. minWidth: 200,
  764. prop: 'orderNo',
  765. slot: 'orderNo',
  766. label: '订单编码',
  767. showOverflowTooltip: true,
  768. align: 'center'
  769. };
  770. }
  771. return [
  772. {
  773. width: 45,
  774. type: 'index',
  775. columnKey: 'index',
  776. align: 'center',
  777. fixed: 'left'
  778. },
  779. orderColumn,
  780. {
  781. width: 280,
  782. prop: 'productName',
  783. label: '名称',
  784. slot: 'productName',
  785. headerSlot: 'headerProductName',
  786. align: 'center'
  787. },
  788. {
  789. width: 120,
  790. prop: 'productCode',
  791. label: '编码',
  792. slot: 'productCode',
  793. align: 'center'
  794. },
  795. {
  796. width: 200,
  797. prop: 'productCategoryName',
  798. label: '类型',
  799. slot: 'productCategoryName',
  800. align: 'center'
  801. },
  802. {
  803. width: 160,
  804. prop: 'productBrand',
  805. label: '牌号',
  806. slot: 'productBrand',
  807. align: 'center'
  808. },
  809. {
  810. width: 120,
  811. prop: 'modelType',
  812. label: '型号',
  813. slot: 'modelType',
  814. align: 'center'
  815. },
  816. {
  817. width: 120,
  818. prop: 'specification',
  819. label: '规格',
  820. slot: 'specification',
  821. align: 'center'
  822. },
  823. {
  824. width: 160,
  825. prop: 'modelKey',
  826. label: '机型',
  827. slot: 'modelKey',
  828. align: 'center'
  829. },
  830. {
  831. width: 160,
  832. prop: 'colorKey',
  833. label: '颜色',
  834. slot: 'colorKey',
  835. align: 'center'
  836. },
  837. {
  838. width: 120,
  839. prop: 'imgCode',
  840. align: 'center',
  841. label: '图号/件号',
  842. showOverflowTooltip: true
  843. },
  844. {
  845. width: 120,
  846. prop: 'produceType',
  847. align: 'center',
  848. label: '属性类型',
  849. showOverflowTooltip: true,
  850. formatter: (row, column) => {
  851. if (row.produceType) {
  852. return row.produceType
  853. .map((item) => {
  854. return lbjtList[item];
  855. })
  856. .toString();
  857. }
  858. }
  859. },
  860. {
  861. minWidth: 160,
  862. prop: 'productionCodes',
  863. label: '生产编号',
  864. align: 'center'
  865. },
  866. {
  867. minWidth: 240,
  868. prop: 'taskName',
  869. label: '工序',
  870. slot: 'taskName',
  871. align: 'center'
  872. },
  873. {
  874. width: 120,
  875. prop: 'packingSpecification',
  876. align: 'center',
  877. label: '包装规格',
  878. showOverflowTooltip: true
  879. },
  880. {
  881. width: 200,
  882. prop: 'customerMark',
  883. label: '客户代号',
  884. slot: 'customerMark',
  885. align: 'center'
  886. },
  887. {
  888. width: 150,
  889. prop: 'saleCount',
  890. label: '数量',
  891. slot: 'saleCount',
  892. headerSlot: 'headerTotalCount',
  893. align: 'center'
  894. },
  895. {
  896. width: 150,
  897. prop: 'saleUnit',
  898. label: '单位',
  899. slot: 'saleUnit',
  900. align: 'center'
  901. },
  902. {
  903. width: 150,
  904. prop: 'totalCount',
  905. label: '计量数量',
  906. // slot: 'totalCount',
  907. // headerSlot: 'headerTotalCount',
  908. align: 'center'
  909. },
  910. {
  911. width: 120,
  912. prop: 'measuringUnit',
  913. label: '计量单位',
  914. slot: 'measuringUnit',
  915. align: 'center'
  916. },
  917. {
  918. width: 120,
  919. prop: 'packingSpecification',
  920. align: 'center',
  921. label: '包装规格',
  922. showOverflowTooltip: true
  923. },
  924. {
  925. width: 110,
  926. prop: 'batchNo',
  927. label: '批次号',
  928. slot: 'batchNo',
  929. align: 'center'
  930. },
  931. {
  932. width: 120,
  933. prop: 'availableCountBase',
  934. label: '库存数量',
  935. slot: 'availableCountBase',
  936. align: 'center'
  937. },
  938. {
  939. prop: 'provenance',
  940. label: '产地',
  941. slot: 'provenance',
  942. align: 'center',
  943. showOverflowTooltip: true,
  944. minWidth: 200
  945. },
  946. {
  947. width: 120,
  948. prop: 'singleWeight',
  949. label: '单重',
  950. slot: 'singleWeight',
  951. headerSlot: 'headerSingleWeight',
  952. align: 'center'
  953. },
  954. {
  955. width: 120,
  956. prop: 'totalWeight',
  957. label: '总重',
  958. slot: 'totalWeight',
  959. align: 'center'
  960. },
  961. {
  962. width: 120,
  963. prop: 'weightUnit',
  964. label: '重量单位',
  965. slot: 'weightUnit',
  966. align: 'center'
  967. },
  968. // {
  969. // width: 160,
  970. // prop: 'pricingWay',
  971. // label: '计价方式',
  972. // headerSlot: 'headerPricingWay',
  973. // slot: 'pricingWay',
  974. // align: 'center'
  975. // },
  976. {
  977. width: 200,
  978. prop: 'singlePrice',
  979. label: '单价',
  980. slot: 'singlePrice',
  981. headerSlot: 'headerSinglePrice',
  982. align: 'center'
  983. },
  984. {
  985. width: 160,
  986. prop: 'taxRate',
  987. label: '税率',
  988. slot: 'taxRate',
  989. align: 'center'
  990. },
  991. {
  992. width: 180,
  993. prop: 'notaxSinglePrice',
  994. label: '不含税单价',
  995. slot: 'notaxSinglePrice',
  996. align: 'center'
  997. },
  998. {
  999. width: 160,
  1000. prop: 'discountSinglePrice',
  1001. label: '折让单价',
  1002. align: 'center',
  1003. show: this.isDiscount,
  1004. formatter: (_row, _column, cellValue) => {
  1005. return _row.discountSinglePrice
  1006. ? Number(_row.discountSinglePrice).toFixed(2)
  1007. : '';
  1008. }
  1009. },
  1010. {
  1011. width: 120,
  1012. prop: 'totalPrice',
  1013. label: '合计',
  1014. slot: 'totalPrice',
  1015. align: 'center'
  1016. },
  1017. {
  1018. width: 160,
  1019. prop: 'discountTotalPrice',
  1020. label: '折让合计',
  1021. align: 'center',
  1022. show: this.isDiscount,
  1023. formatter: (_row, _column, cellValue) => {
  1024. return _row.discountTotalPrice
  1025. ? Number(_row.discountTotalPrice).toFixed(2)
  1026. : '';
  1027. }
  1028. },
  1029. {
  1030. width: 160,
  1031. prop: 'customerExpectDeliveryDeadline',
  1032. label: '客户期望交期',
  1033. slot: 'customerExpectDeliveryDeadline',
  1034. headerSlot: 'headerCustomerExpectDeliveryDeadline',
  1035. align: 'center'
  1036. },
  1037. this.contractBookType == 1
  1038. ? {
  1039. width: 160,
  1040. prop: 'produceDeliveryDeadline',
  1041. label: '生产交付交期',
  1042. slot: 'produceDeliveryDeadline',
  1043. headerSlot: 'headerProduceDeliveryDeadline',
  1044. align: 'center'
  1045. }
  1046. : {
  1047. width: 1
  1048. },
  1049. {
  1050. width: 200,
  1051. prop: 'guaranteePeriod',
  1052. label: '有效期',
  1053. slot: 'guaranteePeriod',
  1054. // headerSlot: 'headerCustomerExpectDeliveryDeadline',
  1055. align: 'center'
  1056. },
  1057. this.isGuaranteePeriod
  1058. ? {
  1059. width: 200,
  1060. prop: 'guaranteePeriodDeadline',
  1061. label: '有效期截止日期',
  1062. slot: 'guaranteePeriodDeadline',
  1063. show: this.isGuaranteePeriod,
  1064. align: 'center'
  1065. }
  1066. : {
  1067. width: 1
  1068. },
  1069. {
  1070. width: 220,
  1071. prop: 'customerReqFiles',
  1072. label: '客户需求',
  1073. slot: 'customerReqFiles',
  1074. align: 'center'
  1075. },
  1076. {
  1077. width: 130,
  1078. prop: 'technicalAnswerName',
  1079. label: '技术答疑人',
  1080. slot: 'technicalAnswerName',
  1081. align: 'center'
  1082. },
  1083. {
  1084. width: 220,
  1085. prop: 'technicalParams',
  1086. label: '技术参数',
  1087. slot: 'technicalParams',
  1088. align: 'center'
  1089. },
  1090. {
  1091. width: 240,
  1092. prop: 'technicalDrawings',
  1093. label: '技术图纸',
  1094. slot: 'technicalDrawings',
  1095. align: 'center'
  1096. },
  1097. {
  1098. width: 240,
  1099. prop: 'technologyRouteName',
  1100. label: '工艺路线',
  1101. slot: 'technologyRouteName',
  1102. align: 'center'
  1103. },
  1104. {
  1105. width: 240,
  1106. prop: 'industryArtFiles',
  1107. label: '工艺附件',
  1108. slot: 'industryArtFiles',
  1109. align: 'center'
  1110. },
  1111. {
  1112. width: 240,
  1113. prop: 'otherFiles',
  1114. label: '其他附件',
  1115. slot: 'otherFiles',
  1116. align: 'center'
  1117. },
  1118. {
  1119. width: 220,
  1120. prop: 'remark',
  1121. label: '备注',
  1122. slot: 'remark',
  1123. align: 'center'
  1124. },
  1125. {
  1126. columnKey: 'action',
  1127. label: '操作',
  1128. width: 120,
  1129. align: 'center',
  1130. resizable: false,
  1131. slot: 'action',
  1132. fixed: 'right',
  1133. showOverflowTooltip: true
  1134. }
  1135. ];
  1136. }
  1137. },
  1138. created() {
  1139. this.getDictList('productionType');
  1140. },
  1141. methods: {
  1142. packingChange(item, index) {
  1143. this.$set(
  1144. this.form.datasource[index],
  1145. this.countObj.unitKey,
  1146. item.conversionUnit
  1147. );
  1148. },
  1149. async getDictList(code) {
  1150. let { data: res } = await getByCode(code);
  1151. this.dictList[code] = res.map((item) => {
  1152. let values = Object.keys(item);
  1153. return {
  1154. value: values[0],
  1155. label: item[values[0]]
  1156. };
  1157. });
  1158. },
  1159. openVersion(index) {
  1160. this.$refs.versionRefs.open(index);
  1161. },
  1162. //工艺路线
  1163. changeProduct(data, index) {
  1164. this.$set(
  1165. this.form.datasource[index],
  1166. 'technologyRouteName',
  1167. data.name
  1168. );
  1169. this.$set(this.form.datasource[index], 'technologyRouteId', data.id);
  1170. },
  1171. setDeliveryDays(row, index, type, isAll) {
  1172. if (isAll) {
  1173. this.form.datasource.forEach((item, i) => {
  1174. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1175. item.guaranteePeriodUnitCode
  1176. );
  1177. this.$set(
  1178. this.form.datasource[i],
  1179. 'guaranteePeriodDeadline',
  1180. guaranteePeriodUnitName != 'second'
  1181. ? this.setDay(
  1182. item.guaranteePeriod,
  1183. guaranteePeriodUnitName,
  1184. item
  1185. )
  1186. : ''
  1187. );
  1188. // }
  1189. });
  1190. return;
  1191. }
  1192. if (type == 'guaranteePeriod') {
  1193. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1194. row.guaranteePeriodUnitCode
  1195. );
  1196. this.$set(
  1197. this.form.datasource[index],
  1198. 'guaranteePeriodDeadline',
  1199. guaranteePeriodUnitName != 'second'
  1200. ? this.setDay(row.guaranteePeriod, guaranteePeriodUnitName, row)
  1201. : ''
  1202. );
  1203. }
  1204. },
  1205. guaranteePeriodUnit(code) {
  1206. return code == 3
  1207. ? 'day'
  1208. : code == 4
  1209. ? 'month'
  1210. : code == 5
  1211. ? 'year'
  1212. : 'second';
  1213. },
  1214. setDay(addDay, dateType = 'day', item) {
  1215. let tiem =
  1216. this.contractBookType == 1
  1217. ? item.produceDeliveryDeadline
  1218. : item.customerExpectDeliveryDeadline;
  1219. return dayjs(tiem || new Date())
  1220. .add(addDay, dateType)
  1221. .format('YYYY-MM-DD');
  1222. },
  1223. // 返回列表数据
  1224. getTableValue() {
  1225. let comitDatasource = copyObj(this.form.datasource);
  1226. console.log(comitDatasource, 'comitDatasource');
  1227. if (comitDatasource.length === 0) return [];
  1228. comitDatasource.forEach((v) => {
  1229. if (v.guaranteePeriodUnitCode) {
  1230. v.guaranteePeriodUnitName = this.getDictValue(
  1231. '保质期单位',
  1232. v.guaranteePeriodUnitCode
  1233. );
  1234. }
  1235. if (v.modelKey) {
  1236. v.modelKey = v.modelKey.toString();
  1237. }
  1238. if (v.colorKey) {
  1239. v.colorKey = v.colorKey.toString();
  1240. }
  1241. v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
  1242. v.customerReqFiles = v.customerReqFiles || [];
  1243. v.industryArtFiles = v.industryArtFiles || [];
  1244. v.otherFiles = v.otherFiles || [];
  1245. });
  1246. return comitDatasource;
  1247. },
  1248. getPrice() {
  1249. return [this.allPrice, this.form.discountTotalPrice];
  1250. },
  1251. orderNoChange(row, item) {
  1252. row['orderId'] = item.orderId;
  1253. },
  1254. //改变数量
  1255. changeCount(row, index) {
  1256. if (!row) {
  1257. this.form.datasource.forEach((item, index) => {
  1258. this.$set(
  1259. this.form,
  1260. 'datasource[' + index + ']',
  1261. changeCount(item, this.countObj)
  1262. );
  1263. });
  1264. } else {
  1265. this.$set(
  1266. this.form,
  1267. 'datasource[' + index + ']',
  1268. changeCount(row, this.countObj)
  1269. );
  1270. }
  1271. this.getNotaxSinglePrice();
  1272. this.changeAll();
  1273. this.$forceUpdate();
  1274. },
  1275. changeAll() {
  1276. this.allPrice = getAllPrice(this.form.datasource) || 0;
  1277. if (this.isDiscountTotalPrice) {
  1278. this.form.discountTotalPrice = this.allPrice;
  1279. this.$emit('setDiscountTotalPrice', this.allPrice);
  1280. }
  1281. this.$emit('setCountAmount', this.allPrice);
  1282. },
  1283. setCustomerMark(customerMark) {
  1284. this.form.datasource.forEach((item) => {
  1285. item['customerMark'] = customerMark;
  1286. this.$forceUpdate();
  1287. });
  1288. },
  1289. //计算不含税单价
  1290. getNotaxSinglePrice() {
  1291. this.form.datasource.forEach((item, index) => {
  1292. if (item.singlePrice && item.taxRate) {
  1293. this.$set(
  1294. this.form.datasource[index],
  1295. 'notaxSinglePrice',
  1296. parseFloat(
  1297. (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
  1298. )
  1299. );
  1300. } else {
  1301. this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
  1302. }
  1303. });
  1304. },
  1305. //修改回显
  1306. async putTableValue(data) {
  1307. let productList =
  1308. (data &&
  1309. (data.quoteProductList || data.productList || data.detailList)) ||
  1310. [];
  1311. if (productList) {
  1312. productList.forEach((item) => {
  1313. if (item.modelKey) {
  1314. item.modelKey = item.modelKey.split(',');
  1315. }
  1316. if (item.colorKey) {
  1317. item.colorKey = item.colorKey.split(',');
  1318. }
  1319. item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode
  1320. ? item.guaranteePeriodUnitCode + ''
  1321. : '';
  1322. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1323. item.guaranteePeriodUnitCode
  1324. );
  1325. if (item.guaranteePeriod && item.guaranteePeriodUnitCode) {
  1326. item['guaranteePeriodDeadline'] =
  1327. item['guaranteePeriodDeadline'] ||
  1328. guaranteePeriodUnitName != 'second'
  1329. ? this.setDay(
  1330. item.guaranteePeriod,
  1331. guaranteePeriodUnitName,
  1332. item
  1333. )
  1334. : '';
  1335. }
  1336. });
  1337. this.form.datasource = productList;
  1338. let codeList = this.form.datasource
  1339. .filter((item) => item.productCode)
  1340. .map((item) => item.productCode);
  1341. //获取仓库库存
  1342. let inventoryTotalList = await getInventoryTotalAPI(codeList);
  1343. this.form.datasource
  1344. .filter((item) => item.productCode)
  1345. .forEach((item, index) => {
  1346. let find =
  1347. inventoryTotalList.find(
  1348. (key) => key.code == item.productCode
  1349. ) || {};
  1350. this.form.datasource;
  1351. this.$set(
  1352. this.form.datasource[index],
  1353. 'availableCountBase',
  1354. find.availableCountBase
  1355. );
  1356. });
  1357. if (this.isChangeCount) {
  1358. this.changeCount();
  1359. } else {
  1360. this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
  1361. }
  1362. if (this.isDiscountTotalPrice) {
  1363. this.form.discountTotalPrice =
  1364. data.payAmount || data?.contractVO?.discountTotalPrice;
  1365. }
  1366. this.$refs.table.reload();
  1367. }
  1368. },
  1369. //计算单重
  1370. //选择产品
  1371. handParent(row, index) {
  1372. let item = {
  1373. id: row.productCode
  1374. };
  1375. this.$refs.productListRef.open(item, index);
  1376. },
  1377. //选择技术人回调
  1378. changeAnswer(obj, idx) {
  1379. this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
  1380. this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
  1381. },
  1382. handHead(row, index) {
  1383. let item = {
  1384. id: row.technicalAnswerId
  1385. };
  1386. this.$refs.headRef.open(item, index);
  1387. },
  1388. //选择产品回调
  1389. changeParent(obj, idx) {
  1390. obj.forEach((item, index) => {
  1391. let i = idx == -1 ? index : idx;
  1392. let row = JSON.parse(JSON.stringify(this.defaultForm));
  1393. row.key = this.form.datasource.length + 1;
  1394. let parasm = idx == -1 ? row : this.form.datasource[i];
  1395. this.$set(parasm, 'productId', item.id);
  1396. this.$set(parasm, 'categoryName', item.name);
  1397. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  1398. this.$set(parasm, 'productBrand', item.brandNum);
  1399. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  1400. this.$set(parasm, 'productCode', item.code);
  1401. this.$set(parasm, 'productName', item.name);
  1402. this.$set(parasm, 'modelType', item.modelType);
  1403. this.$set(parasm, 'availableCountBase', item.availableCountBase);
  1404. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  1405. this.$set(parasm, 'specification', item.specification);
  1406. this.$set(parasm, 'weightUnit', item.weightUnit);
  1407. this.$set(parasm, 'singleWeight', item.netWeight);
  1408. this.$set(parasm, 'pricingWay', item.pricingWay || 1);
  1409. if (item.modelKey) {
  1410. this.$set(parasm, 'modelKey', item.modelKey.split(','));
  1411. }
  1412. if (item.colorKey) {
  1413. this.$set(parasm, 'colorKey', item.colorKey.split(','));
  1414. }
  1415. this.$set(parasm, 'imgCode', item.imgCode);
  1416. this.$set(parasm, 'produceType', item.produceType);
  1417. this.$set(parasm, 'approvalNumber', item.extField.approvalNumber);
  1418. if (this.isOrderNo) {
  1419. this.$set(parasm, 'orderNo', this.orderOption[0]?.orderNo);
  1420. this.$set(parasm, 'orderId', this.orderOption[0]?.orderId);
  1421. }
  1422. this.$set(
  1423. parasm,
  1424. 'packingSpecification',
  1425. item.extField.packingSpecification
  1426. );
  1427. this.$set(
  1428. parasm,
  1429. 'packageDispositionList',
  1430. item.packageDispositionList
  1431. );
  1432. if (item.packageDispositionList?.length) {
  1433. this.$set(parasm, 'saleUnitId', item.packageDispositionList[0].id);
  1434. this.$set(
  1435. parasm,
  1436. 'saleUnit',
  1437. item.packageDispositionList[0].conversionUnit
  1438. );
  1439. }
  1440. this.$set(parasm, 'customerMark', this.customerMark);
  1441. if (item.purchaseOrigins?.length > 0) {
  1442. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  1443. }
  1444. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  1445. if (idx == -1) {
  1446. this.form.datasource.push(row);
  1447. }
  1448. });
  1449. },
  1450. remove(index) {
  1451. this.form.datasource.splice(index, 1);
  1452. this.setSort();
  1453. this.changeAll();
  1454. },
  1455. // 重新排序
  1456. setSort() {
  1457. this.form.datasource.forEach((n, index) => {
  1458. n.key = index + 1;
  1459. });
  1460. },
  1461. // 添加
  1462. handlAdd() {
  1463. let item = JSON.parse(JSON.stringify(this.defaultForm));
  1464. item.key = this.form.datasource.length + 1;
  1465. this.form.datasource.push(item);
  1466. },
  1467. validateForm(callback) {
  1468. // let singleWeightData = {};
  1469. // this.form.datasource.forEach((item) => {
  1470. // if (item.pricingWay == 2 && !item.singleWeight) {
  1471. // singleWeightData['name'] = item.productName;
  1472. // }
  1473. // });
  1474. // if (singleWeightData.name) {
  1475. // this.$message.warning(
  1476. // singleWeightData.name + '计价方式为重量,单重不能为空'
  1477. // );
  1478. // callback(false);
  1479. // }
  1480. //开始表单校验
  1481. this.$refs.form.validate((valid, obj) => {
  1482. if (obj) {
  1483. let messages = Object.keys(obj).map((key) => obj[key][0]);
  1484. if (messages.length > 0) {
  1485. this.$message.warning(messages[0].message);
  1486. }
  1487. }
  1488. callback(valid);
  1489. });
  1490. },
  1491. save() {
  1492. this.$emit('save');
  1493. }
  1494. }
  1495. };
  1496. </script>
  1497. <style lang="scss" scoped>
  1498. .headbox {
  1499. display: flex;
  1500. justify-content: space-between;
  1501. align-items: center;
  1502. .amount {
  1503. font-size: 14px;
  1504. font-weight: bold;
  1505. padding-right: 30px;
  1506. }
  1507. }
  1508. .time-form .el-form-item {
  1509. margin-bottom: 0 !important;
  1510. }
  1511. ::v-deep .period {
  1512. display: flex;
  1513. .borderleftnone {
  1514. .el-input--medium .el-input__inner {
  1515. border-top-right-radius: 0;
  1516. border-bottom-right-radius: 0;
  1517. }
  1518. }
  1519. .borderrightnone {
  1520. .el-input--medium .el-input__inner {
  1521. border-top-left-radius: 0;
  1522. border-bottom-left-radius: 0;
  1523. }
  1524. }
  1525. }
  1526. ::v-deep .time-form tbody > tr:hover > td {
  1527. background-color: transparent !important;
  1528. }
  1529. ::v-deep .time-form .el-table tr {
  1530. background-color: #ffffff;
  1531. }
  1532. .pricebox {
  1533. display: flex;
  1534. justify-content: flex-start;
  1535. align-items: center;
  1536. font-weight: bold;
  1537. }
  1538. </style>