inventoryTable.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315
  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="isContractId || 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. :disabled="isContractId"
  129. v-model="scope.row.totalCount"
  130. type="number"
  131. placeholder="请输入"
  132. @input="changeCount(scope.row, scope.$index)"
  133. ></el-input>
  134. </el-form-item>
  135. </template>
  136. <template v-slot:headerTotalCount="{ column }">
  137. <span :class="{ 'is-required': isTotalCount }">{{ column.label }}</span>
  138. </template>
  139. <template v-slot:totalPrice="scope">
  140. <el-form-item
  141. style="margin-bottom: 20px"
  142. :prop="'datasource.' + scope.$index + '.totalPrice'"
  143. >
  144. {{ (Number(scope.row.totalPrice) || 0).toFixed(2) }}元
  145. </el-form-item>
  146. </template>
  147. <template v-slot:productBrand="scope">
  148. <el-form-item
  149. style="margin-bottom: 20px"
  150. :prop="'datasource.' + scope.$index + '.productBrand'"
  151. >
  152. <el-input
  153. v-model="scope.row.productBrand"
  154. :disabled="scope.row.productCode"
  155. ></el-input>
  156. </el-form-item>
  157. </template>
  158. <template v-slot:modelType="scope">
  159. <el-form-item
  160. style="margin-bottom: 20px"
  161. :prop="'datasource.' + scope.$index + '.modelType'"
  162. >
  163. <el-input
  164. v-model="scope.row.modelType"
  165. :disabled="scope.row.productCode"
  166. ></el-input>
  167. </el-form-item>
  168. </template>
  169. <template v-slot:specification="scope">
  170. <el-form-item
  171. style="margin-bottom: 20px"
  172. :prop="'datasource.' + scope.$index + '.specification'"
  173. >
  174. <el-input
  175. v-model="scope.row.specification"
  176. :disabled="scope.row.productCode"
  177. ></el-input>
  178. </el-form-item>
  179. </template>
  180. <template v-slot:guaranteePeriod="scope">
  181. <div class="period">
  182. <div class="borderleftnone">
  183. <el-form-item
  184. style="margin-bottom: 20px"
  185. :prop="'datasource.' + scope.$index + '.guaranteePeriod'"
  186. :rules="{
  187. pattern: numberReg,
  188. message: '请输入质保期',
  189. trigger: 'blur'
  190. }"
  191. >
  192. <el-input
  193. :disabled="isContractId"
  194. v-model="scope.row.guaranteePeriod"
  195. @change="
  196. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  197. "
  198. placeholder="请输入"
  199. ></el-input>
  200. </el-form-item>
  201. </div>
  202. <div class="borderrightnone">
  203. <DictSelection
  204. dictName="质保期单位"
  205. clearable
  206. v-model="scope.row.guaranteePeriodUnitCode"
  207. :disabled="isContractId"
  208. @change="
  209. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  210. "
  211. >
  212. </DictSelection>
  213. </div>
  214. </div>
  215. </template>
  216. <template v-slot:measuringUnit="scope">
  217. <el-form-item
  218. style="margin-bottom: 20px"
  219. :prop="'datasource.' + scope.$index + '.measuringUnit'"
  220. >
  221. <el-input
  222. v-model="scope.row.measuringUnit"
  223. :disabled="scope.row.productCode"
  224. placeholder="请输入"
  225. ></el-input>
  226. </el-form-item>
  227. </template>
  228. <template v-slot:remark="scope">
  229. <el-form-item
  230. style="margin-bottom: 20px"
  231. :prop="'datasource.' + scope.$index + '.remark'"
  232. >
  233. <el-input
  234. :disabled="isContractId"
  235. v-model="scope.row.remark"
  236. type="textarea"
  237. placeholder="请输入"
  238. ></el-input>
  239. </el-form-item>
  240. </template>
  241. <template v-slot:singlePrice="scope">
  242. <el-form-item
  243. style="margin-bottom: 20px"
  244. :prop="'datasource.' + scope.$index + '.singlePrice'"
  245. :rules="{
  246. required: isSinglePrice ? true : false,
  247. message: '请输入单价',
  248. trigger: 'change'
  249. }"
  250. >
  251. <el-input
  252. :disabled="isContractId"
  253. v-model="scope.row.singlePrice"
  254. placeholder="请输入"
  255. type="number"
  256. @input="changeCount(scope.row, scope.$index)"
  257. >
  258. <template slot="append">元</template>
  259. </el-input>
  260. </el-form-item>
  261. </template>
  262. <template v-slot:taxRate="scope">
  263. <el-form-item
  264. style="margin-bottom: 20px"
  265. :prop="'datasource.' + scope.$index + '.taxRate'"
  266. >
  267. <el-input
  268. :disabled="isContractId"
  269. v-model="scope.row.taxRate"
  270. placeholder="请输入"
  271. type="number"
  272. >
  273. <template slot="append">%</template>
  274. </el-input>
  275. </el-form-item>
  276. </template>
  277. <template v-slot:headerSinglePrice="{ column }">
  278. <span :class="isSinglePrice ? 'is-required' : ''">{{
  279. column.label
  280. }}</span>
  281. </template>
  282. <template v-slot:headerCustomerExpectDeliveryDeadline="{ column }">
  283. <span :class="contractBookType == 1 ? 'is-required' : ''">{{
  284. column.label
  285. }}</span>
  286. </template>
  287. <template v-slot:technicalAnswerName="{ row, $index }">
  288. <el-form-item
  289. style="margin-bottom: 20px"
  290. :prop="'datasource.' + $index + '.technicalAnswerName'"
  291. >
  292. <el-input
  293. v-model="row.technicalAnswerName"
  294. placeholder="请输入"
  295. :disabled="isContractId"
  296. @click.native="handHead(row, $index)"
  297. ></el-input>
  298. </el-form-item>
  299. </template>
  300. <template v-slot:technicalParams="scope">
  301. <el-form-item
  302. style="margin-bottom: 20px"
  303. :prop="'datasource.' + scope.$index + '.technicalParams'"
  304. >
  305. <el-input
  306. type="textarea"
  307. v-model="scope.row.technicalParams"
  308. :disabled="isContractId"
  309. placeholder="请输入"
  310. ></el-input>
  311. </el-form-item>
  312. </template>
  313. <template v-slot:provenance="scope">
  314. <el-form-item :prop="'datasource.' + scope.$index + '.provenance'">
  315. <DictSelection
  316. dictName="产地"
  317. clearable
  318. v-model="scope.row.provenance"
  319. collapse-tags
  320. multiple
  321. >
  322. </DictSelection>
  323. </el-form-item>
  324. </template>
  325. <template v-slot:technicalDrawings="scope">
  326. <el-form-item
  327. style="margin-bottom: 20px"
  328. :prop="'datasource.' + scope.$index + '.technicalDrawings'"
  329. >
  330. <fileMain
  331. v-model="scope.row.technicalDrawings"
  332. :type="isContractId ? 'view' : ''"
  333. ></fileMain>
  334. </el-form-item>
  335. </template>
  336. <template v-slot:customerReqFiles="scope">
  337. <el-form-item
  338. style="margin-bottom: 20px"
  339. :prop="'datasource.' + scope.$index + '.customerReqFiles'"
  340. >
  341. <fileMain
  342. v-model="scope.row.customerReqFiles"
  343. :type="isContractId ? 'view' : ''"
  344. ></fileMain>
  345. </el-form-item>
  346. </template>
  347. <template v-slot:industryArtFiles="scope">
  348. <el-form-item
  349. style="margin-bottom: 20px"
  350. :prop="'datasource.' + scope.$index + '.industryArtFiles'"
  351. :rules="{
  352. required: false,
  353. message: '请输入',
  354. trigger: 'change'
  355. }"
  356. >
  357. <fileMain
  358. v-model="scope.row.industryArtFiles"
  359. :type="isContractId ? 'view' : ''"
  360. ></fileMain>
  361. </el-form-item>
  362. </template>
  363. <template v-slot:otherFiles="scope">
  364. <el-form-item
  365. style="margin-bottom: 20px"
  366. :prop="'datasource.' + scope.$index + '. otherFiles'"
  367. >
  368. <fileMain
  369. v-model="scope.row.otherFiles"
  370. :type="isContractId ? 'view' : ''"
  371. ></fileMain>
  372. </el-form-item>
  373. </template>
  374. <template v-slot:headerProduceDeliveryDeadline="{ column }">
  375. <span :class="isProduceDeliveryDeadline ? 'is-required' : ''">{{
  376. column.label
  377. }}</span>
  378. </template>
  379. <template v-slot:produceDeliveryDeadline="scope">
  380. <el-form-item
  381. :prop="'datasource.' + scope.$index + '.produceDeliveryDeadline'"
  382. :rules="{
  383. required: isProduceDeliveryDeadline ? true : false,
  384. message: '选择生产交付交期',
  385. trigger: 'change'
  386. }"
  387. >
  388. <el-date-picker
  389. style="width: 140px"
  390. v-model="scope.row.produceDeliveryDeadline"
  391. @change="
  392. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  393. "
  394. type="date"
  395. placeholder="选择日期"
  396. >
  397. </el-date-picker>
  398. </el-form-item>
  399. </template>
  400. <template v-slot:customerExpectDeliveryDeadline="scope">
  401. <el-form-item
  402. :rules="{
  403. required: true,
  404. message:
  405. contractBookType == 1 ? '请选择客户期望交期' : '请选择交付日期',
  406. trigger: 'change'
  407. }"
  408. :prop="
  409. 'datasource.' + scope.$index + '.customerExpectDeliveryDeadline'
  410. "
  411. >
  412. <el-date-picker
  413. style="width: 140px"
  414. :disabled="isContractId"
  415. v-model="scope.row.customerExpectDeliveryDeadline"
  416. @change="
  417. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  418. "
  419. type="date"
  420. placeholder="选择日期"
  421. >
  422. </el-date-picker>
  423. </el-form-item>
  424. </template>
  425. <template v-slot:guaranteePeriodDeadline="scope">
  426. <el-form-item
  427. :prop="'datasource.' + scope.$index + '.guaranteePeriodDeadline'"
  428. >
  429. <el-date-picker
  430. style="width: 140px"
  431. :disabled="isContractId"
  432. v-model="scope.row.guaranteePeriodDeadline"
  433. type="date"
  434. placeholder="选择日期"
  435. >
  436. </el-date-picker>
  437. </el-form-item>
  438. </template>
  439. <template v-slot:singleWeight="scope">
  440. <el-form-item
  441. style="margin-bottom: 20px"
  442. :prop="'datasource.' + scope.$index + '.singleWeight'"
  443. >
  444. <el-input
  445. :disabled="isContractId"
  446. v-model="scope.row.singleWeight"
  447. @input="changeCount(scope.row, scope.$index)"
  448. placeholder="请输入"
  449. ></el-input>
  450. </el-form-item>
  451. </template>
  452. <template v-slot:technologyRouteName="scope">
  453. <el-form-item
  454. :prop="'datasource.' + scope.$index + '.technologyRouteName'"
  455. :rules="{
  456. required: false,
  457. message: '请选择',
  458. trigger: 'change'
  459. }"
  460. >
  461. <el-input
  462. v-model="scope.row.technologyRouteName"
  463. :disabled="isContractId"
  464. placeholder="请选择"
  465. @click.native="openVersion(scope.$index)"
  466. ></el-input>
  467. </el-form-item>
  468. </template>
  469. <template v-slot:pricingWay="scope">
  470. <el-form-item :prop="'datasource.' + scope.$index + '.pricingWay'">
  471. <el-select
  472. v-model="scope.row.pricingWay"
  473. placeholder="请选择"
  474. :rules="{
  475. required: true,
  476. message: '请选择计价方式',
  477. trigger: 'change'
  478. }"
  479. >
  480. <el-option
  481. v-for="item in pricingWayList"
  482. :key="item.id"
  483. :label="item.name"
  484. :value="item.id"
  485. @click.native="changeCount(scope.row, scope.$index)"
  486. >
  487. </el-option>
  488. </el-select>
  489. </el-form-item>
  490. </template>
  491. <template v-slot:headerPricingWay="{ column }">
  492. <span class="is-required">{{ column.label }}</span>
  493. </template>
  494. <!-- 操作列 -->
  495. <template v-slot:action="scope">
  496. <el-popconfirm
  497. class="ele-action"
  498. title="确定要删除吗?"
  499. @confirm="remove(scope.$index)"
  500. >
  501. <template v-slot:reference>
  502. <el-link type="danger" :underline="false" icon="el-icon-delete">
  503. 删除
  504. </el-link>
  505. </template>
  506. </el-popconfirm>
  507. </template>
  508. </ele-pro-table>
  509. <product-list
  510. ref="productListRef"
  511. classType="1"
  512. :is-get-inventory-total="true"
  513. @changeParent="changeParent"
  514. ></product-list>
  515. <head-list ref="headRef" @changeParent="changeAnswer"></head-list>
  516. <ProductionVersion
  517. ref="versionRefs"
  518. @changeProduct="changeProduct"
  519. ></ProductionVersion>
  520. <!-- <taskinstance-dialog
  521. ref="taskinstanceDialogRef"
  522. v-if="taskinstanceDialogFlag"
  523. @saveTaskInstance="saveTaskInstance"
  524. :visible.sync="taskinstanceDialogFlag"
  525. ></taskinstance-dialog> -->
  526. </el-form>
  527. </template>
  528. <script>
  529. import { numberReg } from 'ele-admin';
  530. import productList from '@/BIZComponents/product-list.vue';
  531. import dictMixins from '@/mixins/dictMixins';
  532. import fileUpload from '@/components/upload/fileUpload';
  533. import headList from '@/BIZComponents/user-select/user-select.vue';
  534. import ProductionVersion from '@/components/ProductionVersion2/index.vue';
  535. import { getByCode } from '@/api/system/dictionary-data';
  536. import fileMain from '@/components/addDoc/index.vue';
  537. import { pricingWayList,lbjtList } from '@/enum/dict.js';
  538. import { changeCount } from '@/BIZComponents/setProduct.js';
  539. import { getInventoryTotalAPI } from '@/api/bpm/components/wms/index.js';
  540. // import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
  541. const dayjs = require('dayjs');
  542. export default {
  543. mixins: [dictMixins],
  544. components: {
  545. fileMain,
  546. productList,
  547. fileUpload,
  548. headList,
  549. ProductionVersion
  550. },
  551. props: {
  552. pageName: {
  553. default: '',
  554. type: String
  555. },
  556. isDiscountTotalPrice: {
  557. default: false,
  558. type: Boolean
  559. },
  560. isGuaranteePeriod: {
  561. default: true,
  562. type: Boolean
  563. },
  564. isProduceDeliveryDeadline: {
  565. //生产交付交期必填
  566. type: Boolean,
  567. default: false
  568. },
  569. customerMark: {
  570. default: '',
  571. type: String
  572. },
  573. isContractId: {
  574. type: Boolean,
  575. default: false
  576. },
  577. isSinglePrice: {
  578. //单价必填
  579. type: Boolean,
  580. default: true
  581. },
  582. isTotalCount: {
  583. //数量必填
  584. type: Boolean,
  585. default: true
  586. },
  587. isDrawer: {
  588. type: Boolean,
  589. default: false
  590. },
  591. isChangeCount: {
  592. //默认计算
  593. type: Boolean,
  594. default: true
  595. },
  596. contractBookType: {
  597. //合同类型 1销售 2采购
  598. type: [String, Number],
  599. default: 1
  600. },
  601. isSupplierMark: {
  602. //客户代号必填
  603. type: Boolean,
  604. default: false
  605. },
  606. isTemporary: {
  607. //临时
  608. type: Boolean,
  609. default: false
  610. },
  611. isDiscount: {
  612. //折让
  613. type: Boolean,
  614. default: true
  615. }
  616. },
  617. data() {
  618. const defaultForm = {
  619. key: null,
  620. endTime: '',
  621. isFirst: 0,
  622. name: '',
  623. startTime: '',
  624. workHour: '',
  625. guaranteePeriodUnitCode: '',
  626. technicalDrawings: []
  627. };
  628. return {
  629. allPrice: 0,
  630. numberReg,
  631. defaultForm,
  632. form: {
  633. discountTotalPrice: 0,
  634. datasource: []
  635. },
  636. pricingWayList,
  637. rules: {},
  638. dictList: {},
  639. columns: [
  640. {
  641. width: 45,
  642. type: 'index',
  643. columnKey: 'index',
  644. align: 'center',
  645. fixed: 'left'
  646. },
  647. {
  648. width: 280,
  649. prop: 'productName',
  650. label: '名称',
  651. slot: 'productName',
  652. headerSlot: 'headerProductName',
  653. align: 'center'
  654. },
  655. {
  656. width: 120,
  657. prop: 'productCode',
  658. label: '编码',
  659. slot: 'productCode',
  660. align: 'center'
  661. },
  662. {
  663. width: 200,
  664. prop: 'productCategoryName',
  665. label: '类型',
  666. slot: 'productCategoryName',
  667. align: 'center'
  668. },
  669. {
  670. width: 160,
  671. prop: 'productBrand',
  672. label: '牌号',
  673. slot: 'productBrand',
  674. align: 'center'
  675. },
  676. {
  677. width: 120,
  678. prop: 'modelType',
  679. label: '型号',
  680. slot: 'modelType',
  681. align: 'center'
  682. },
  683. {
  684. width: 120,
  685. prop: 'specification',
  686. label: '规格',
  687. slot: 'specification',
  688. align: 'center'
  689. },
  690. {
  691. width: 120,
  692. prop: 'imgCode',
  693. align: 'center',
  694. label: '图号/件号',
  695. showOverflowTooltip: true
  696. },
  697. {
  698. width: 120,
  699. prop: 'produceType',
  700. align: 'center',
  701. label: '属性类型',
  702. showOverflowTooltip: true,
  703. formatter: (row, column) => {
  704. if(row.produceType){
  705. return row.produceType.map(item=>{
  706. return lbjtList[item]
  707. }).toString()
  708. }
  709. }
  710. },
  711. {
  712. minWidth: 240,
  713. prop: 'taskName',
  714. label: '工序',
  715. slot: 'taskName',
  716. align: 'center'
  717. },
  718. {
  719. width: 120,
  720. prop: 'packingSpecification',
  721. align: 'center',
  722. label: '包装规格',
  723. showOverflowTooltip: true
  724. },
  725. {
  726. width: 200,
  727. prop: 'customerMark',
  728. label: '客户代号',
  729. slot: 'customerMark',
  730. align: 'center'
  731. },
  732. {
  733. width: 150,
  734. prop: 'totalCount',
  735. label: '数量',
  736. slot: 'totalCount',
  737. headerSlot: 'headerTotalCount',
  738. align: 'center'
  739. },
  740. {
  741. width: 120,
  742. prop: 'availableCountBase',
  743. label: '库存数量',
  744. slot: 'availableCountBase',
  745. align: 'center'
  746. },
  747. {
  748. prop: 'provenance',
  749. label: '产地',
  750. slot: 'provenance',
  751. align: 'center',
  752. showOverflowTooltip: true,
  753. minWidth: 200
  754. },
  755. {
  756. width: 120,
  757. prop: 'measuringUnit',
  758. label: '计量单位',
  759. slot: 'measuringUnit',
  760. align: 'center'
  761. },
  762. {
  763. width: 120,
  764. prop: 'singleWeight',
  765. label: '单重',
  766. slot: 'singleWeight',
  767. headerSlot: 'headerSingleWeight',
  768. align: 'center'
  769. },
  770. {
  771. width: 120,
  772. prop: 'totalWeight',
  773. label: '总重',
  774. slot: 'totalWeight',
  775. align: 'center'
  776. },
  777. {
  778. width: 120,
  779. prop: 'weightUnit',
  780. label: '重量单位',
  781. slot: 'weightUnit',
  782. align: 'center'
  783. },
  784. {
  785. width: 160,
  786. prop: 'pricingWay',
  787. label: '计价方式',
  788. headerSlot: 'headerPricingWay',
  789. slot: 'pricingWay',
  790. align: 'center'
  791. },
  792. {
  793. width: 200,
  794. prop: 'singlePrice',
  795. label: '单价',
  796. slot: 'singlePrice',
  797. headerSlot: 'headerSinglePrice',
  798. align: 'center'
  799. },
  800. {
  801. width: 160,
  802. prop: 'taxRate',
  803. label: '税率',
  804. slot: 'taxRate',
  805. align: 'center'
  806. },
  807. {
  808. width: 160,
  809. prop: 'discountSinglePrice',
  810. label: '折让单价',
  811. align: 'center',
  812. show: this.isDiscount,
  813. formatter: (_row, _column, cellValue) => {
  814. return _row.discountSinglePrice
  815. ? Number(_row.discountSinglePrice).toFixed(2)
  816. : '';
  817. }
  818. },
  819. {
  820. width: 120,
  821. prop: 'totalPrice',
  822. label: '合计',
  823. slot: 'totalPrice',
  824. align: 'center'
  825. },
  826. {
  827. width: 160,
  828. prop: 'discountTotalPrice',
  829. label: '折让合计',
  830. align: 'center',
  831. show: this.isDiscount,
  832. formatter: (_row, _column, cellValue) => {
  833. return _row.discountTotalPrice
  834. ? Number(_row.discountTotalPrice).toFixed(2)
  835. : '';
  836. }
  837. },
  838. {
  839. width: 160,
  840. prop: 'customerExpectDeliveryDeadline',
  841. label: '客户期望交期',
  842. slot: 'customerExpectDeliveryDeadline',
  843. headerSlot: 'headerCustomerExpectDeliveryDeadline',
  844. align: 'center'
  845. },
  846. {
  847. width: 160,
  848. prop: 'produceDeliveryDeadline',
  849. label: '生产交付交期',
  850. slot: 'produceDeliveryDeadline',
  851. headerSlot: 'headerProduceDeliveryDeadline',
  852. show: this.contractBookType == 1,
  853. align: 'center'
  854. },
  855. {
  856. width: 200,
  857. prop: 'guaranteePeriod',
  858. label: '质保期',
  859. slot: 'guaranteePeriod',
  860. // headerSlot: 'headerCustomerExpectDeliveryDeadline',
  861. align: 'center'
  862. },
  863. {
  864. width: 200,
  865. prop: 'guaranteePeriodDeadline',
  866. label: '质保期截止日期',
  867. slot: 'guaranteePeriodDeadline',
  868. show: this.isGuaranteePeriod,
  869. align: 'center'
  870. },
  871. {
  872. width: 220,
  873. prop: 'customerReqFiles',
  874. label: '客户需求',
  875. slot: 'customerReqFiles',
  876. align: 'center'
  877. },
  878. {
  879. width: 130,
  880. prop: 'technicalAnswerName',
  881. label: '技术答疑人',
  882. slot: 'technicalAnswerName',
  883. align: 'center'
  884. },
  885. {
  886. width: 220,
  887. prop: 'technicalParams',
  888. label: '技术参数',
  889. slot: 'technicalParams',
  890. align: 'center'
  891. },
  892. {
  893. width: 240,
  894. prop: 'technicalDrawings',
  895. label: '技术图纸',
  896. slot: 'technicalDrawings',
  897. align: 'center'
  898. },
  899. {
  900. width: 240,
  901. prop: 'technologyRouteName',
  902. label: '工艺路线',
  903. slot: 'technologyRouteName',
  904. align: 'center'
  905. },
  906. {
  907. width: 240,
  908. prop: 'industryArtFiles',
  909. label: '工艺附件',
  910. slot: 'industryArtFiles',
  911. align: 'center'
  912. },
  913. {
  914. width: 240,
  915. prop: 'otherFiles',
  916. label: '其他附件',
  917. slot: 'otherFiles',
  918. align: 'center'
  919. },
  920. {
  921. width: 220,
  922. prop: 'remark',
  923. label: '备注',
  924. slot: 'remark',
  925. align: 'center'
  926. },
  927. {
  928. columnKey: 'action',
  929. label: '操作',
  930. width: 120,
  931. align: 'center',
  932. resizable: false,
  933. slot: 'action',
  934. fixed: 'right',
  935. showOverflowTooltip: true
  936. }
  937. ]
  938. };
  939. },
  940. computed: {
  941. canHandl() {
  942. return this.form.datasource.length;
  943. }
  944. },
  945. created() {
  946. this.getDictList('productionType');
  947. },
  948. methods: {
  949. getDictV(code, val) {
  950. if (!this.dictList[code]) return '';
  951. return this.dictList[code].find((item) => item.value == val)?.label;
  952. },
  953. async getDictList(code) {
  954. let { data: res } = await getByCode(code);
  955. this.dictList[code] = res.map((item) => {
  956. let values = Object.keys(item);
  957. return {
  958. value: values[0],
  959. label: item[values[0]]
  960. };
  961. });
  962. },
  963. downloadFile(file) {
  964. getFile({ objectName: file.storePath }, file.name);
  965. },
  966. openVersion(index) {
  967. this.$refs.versionRefs.open(index);
  968. },
  969. //工艺路线
  970. changeProduct(data, index) {
  971. this.$set(
  972. this.form.datasource[index],
  973. 'technologyRouteName',
  974. data.name
  975. );
  976. this.$set(this.form.datasource[index], 'technologyRouteId', data.id);
  977. },
  978. setDeliveryDays(row, index, type, isAll) {
  979. if (isAll) {
  980. this.form.datasource.forEach((item, i) => {
  981. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  982. item.guaranteePeriodUnitCode
  983. );
  984. this.$set(
  985. this.form.datasource[i],
  986. 'guaranteePeriodDeadline',
  987. guaranteePeriodUnitName != 'second'
  988. ? this.setDay(
  989. item.guaranteePeriod,
  990. guaranteePeriodUnitName,
  991. item
  992. )
  993. : ''
  994. );
  995. // }
  996. });
  997. return;
  998. }
  999. if (type == 'guaranteePeriod') {
  1000. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1001. row.guaranteePeriodUnitCode
  1002. );
  1003. this.$set(
  1004. this.form.datasource[index],
  1005. 'guaranteePeriodDeadline',
  1006. guaranteePeriodUnitName != 'second'
  1007. ? this.setDay(row.guaranteePeriod, guaranteePeriodUnitName, row)
  1008. : ''
  1009. );
  1010. }
  1011. },
  1012. guaranteePeriodUnit(code) {
  1013. return code == 3
  1014. ? 'day'
  1015. : code == 4
  1016. ? 'month'
  1017. : code == 5
  1018. ? 'year'
  1019. : 'second';
  1020. },
  1021. setDay(addDay, dateType = 'day', item) {
  1022. let tiem =
  1023. this.contractBookType == 1
  1024. ? item.produceDeliveryDeadline
  1025. : item.customerExpectDeliveryDeadline;
  1026. return dayjs(tiem || new Date())
  1027. .add(addDay, dateType)
  1028. .format('YYYY-MM-DD');
  1029. },
  1030. // 返回列表数据
  1031. getTableValue() {
  1032. let comitDatasource = this.form.datasource;
  1033. if (comitDatasource.length === 0) return [];
  1034. comitDatasource.forEach((v) => {
  1035. if (v.guaranteePeriodUnitCode) {
  1036. v.guaranteePeriodUnitName = this.getDictValue(
  1037. '保质期单位',
  1038. v.guaranteePeriodUnitCode
  1039. );
  1040. }
  1041. v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
  1042. v.customerReqFiles = v.customerReqFiles || [];
  1043. v.industryArtFiles = v.industryArtFiles || [];
  1044. v.otherFiles = v.otherFiles || [];
  1045. });
  1046. return comitDatasource;
  1047. },
  1048. getPrice() {
  1049. return [this.allPrice, this.form.discountTotalPrice];
  1050. },
  1051. //改变数量
  1052. changeCount(row, index) {
  1053. const { allPrice, arr } = changeCount(row, index, this.form.datasource);
  1054. this.form.datasource = arr;
  1055. this.allPrice = allPrice || 0;
  1056. if (this.isDiscountTotalPrice) {
  1057. this.form.discountTotalPrice = allPrice;
  1058. }
  1059. this.$emit('setCountAmount', this.allPrice);
  1060. },
  1061. setCustomerMark(customerMark) {
  1062. this.form.datasource.forEach((item) => {
  1063. item['customerMark'] = customerMark;
  1064. this.$forceUpdate();
  1065. });
  1066. },
  1067. //修改回显
  1068. async putTableValue(data) {
  1069. let productList =
  1070. (data &&
  1071. (data.quoteProductList || data.productList || data.detailList)) ||
  1072. [];
  1073. if (productList) {
  1074. productList.forEach((item) => {
  1075. item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode
  1076. ? item.guaranteePeriodUnitCode + ''
  1077. : '';
  1078. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1079. item.guaranteePeriodUnitCode
  1080. );
  1081. if (item.guaranteePeriod && item.guaranteePeriodUnitCode) {
  1082. item['guaranteePeriodDeadline'] =
  1083. item['guaranteePeriodDeadline'] ||
  1084. guaranteePeriodUnitName != 'second'
  1085. ? this.setDay(
  1086. item.guaranteePeriod,
  1087. guaranteePeriodUnitName,
  1088. item
  1089. )
  1090. : '';
  1091. }
  1092. });
  1093. this.form.datasource = productList;
  1094. if (this.isChangeCount) {
  1095. this.changeCount();
  1096. } else {
  1097. this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
  1098. }
  1099. if (this.isDiscountTotalPrice) {
  1100. this.form.discountTotalPrice =
  1101. data.payAmount || data?.contractVO?.discountTotalPrice;
  1102. }
  1103. let codeList = this.form.datasource
  1104. .filter((item) => item.productCode)
  1105. .map((item) => item.productCode);
  1106. //获取仓库库存
  1107. let inventoryTotalList = await getInventoryTotalAPI(codeList);
  1108. this.form.datasource
  1109. .filter((item) => item.productCode)
  1110. .forEach((item, index) => {
  1111. let find =
  1112. inventoryTotalList.find(
  1113. (key) => key.code == item.productCode
  1114. ) || {};
  1115. this.form.datasource;
  1116. this.$set(
  1117. this.form.datasource[index],
  1118. 'availableCountBase',
  1119. find.availableCountBase
  1120. );
  1121. });
  1122. this.$refs.table.reload();
  1123. }
  1124. },
  1125. //计算单重
  1126. //选择产品
  1127. handParent(row, index) {
  1128. let item = {
  1129. id: row.productCode
  1130. };
  1131. this.$refs.productListRef.open(item, index);
  1132. },
  1133. //选择技术人回调
  1134. changeAnswer(obj, idx) {
  1135. this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
  1136. this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
  1137. },
  1138. handHead(row, index) {
  1139. let item = {
  1140. id: row.technicalAnswerId
  1141. };
  1142. this.$refs.headRef.open(item, index);
  1143. },
  1144. //选择产品回调
  1145. changeParent(obj, idx) {
  1146. obj.forEach((item, index) => {
  1147. let i = idx == -1 ? index : idx;
  1148. let row = JSON.parse(JSON.stringify(this.defaultForm));
  1149. row.key = this.form.datasource.length + 1;
  1150. let parasm = idx == -1 ? row : this.form.datasource[i];
  1151. this.$set(parasm, 'productId', item.id);
  1152. this.$set(parasm, 'categoryName', item.name);
  1153. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  1154. this.$set(parasm, 'productBrand', item.brandNum);
  1155. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  1156. this.$set(parasm, 'productCode', item.code);
  1157. this.$set(parasm, 'productName', item.name);
  1158. this.$set(parasm, 'modelType', item.modelType);
  1159. this.$set(parasm, 'availableCountBase', item.availableCountBase);
  1160. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  1161. this.$set(parasm, 'specification', item.specification);
  1162. this.$set(parasm, 'weightUnit', item.weightUnit);
  1163. this.$set(parasm, 'singleWeight', item.netWeight);
  1164. this.$set(parasm, 'pricingWay', item.pricingWay || 1);
  1165. this.$set(parasm, 'imgCode', item.imgCode);
  1166. this.$set(parasm, 'produceType', item.produceType);
  1167. this.$set(parasm, 'approvalNumber', item.extField.approvalNumber);
  1168. this.$set(
  1169. parasm,
  1170. 'packingSpecification',
  1171. item.extField.packingSpecification
  1172. );
  1173. this.$set(parasm, 'customerMark', this.customerMark);
  1174. if (item.purchaseOrigins?.length > 0) {
  1175. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  1176. }
  1177. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  1178. if (idx == -1) {
  1179. this.form.datasource.push(row);
  1180. }
  1181. });
  1182. },
  1183. remove(index) {
  1184. this.form.datasource.splice(index, 1);
  1185. this.setSort();
  1186. },
  1187. // 清空表格
  1188. restTable() {
  1189. this.form.datasource = [];
  1190. },
  1191. // 重新排序
  1192. setSort() {
  1193. this.form.datasource.forEach((n, index) => {
  1194. n.key = index + 1;
  1195. });
  1196. },
  1197. // 添加
  1198. handlAdd() {
  1199. let item = JSON.parse(JSON.stringify(this.defaultForm));
  1200. item.key = this.form.datasource.length + 1;
  1201. this.form.datasource.push(item);
  1202. },
  1203. validateForm(callback) {
  1204. let singleWeightData = {};
  1205. this.form.datasource.forEach((item) => {
  1206. if (item.pricingWay == 2 && !item.singleWeight) {
  1207. singleWeightData['name'] = item.productName;
  1208. }
  1209. });
  1210. if (singleWeightData.name) {
  1211. this.$message.warning(
  1212. singleWeightData.name + '计价方式为重量,单重不能为空'
  1213. );
  1214. callback(false);
  1215. }
  1216. //开始表单校验
  1217. this.$refs.form.validate((valid, obj) => {
  1218. if (obj) {
  1219. let messages = Object.keys(obj).map((key) => obj[key][0]);
  1220. if (messages.length > 0) {
  1221. this.$message.warning(messages[0].message);
  1222. }
  1223. }
  1224. callback(valid);
  1225. });
  1226. },
  1227. save() {
  1228. this.$emit('save');
  1229. }
  1230. }
  1231. };
  1232. </script>
  1233. <style lang="scss" scoped>
  1234. .headbox {
  1235. display: flex;
  1236. justify-content: space-between;
  1237. align-items: center;
  1238. .amount {
  1239. font-size: 14px;
  1240. font-weight: bold;
  1241. padding-right: 30px;
  1242. }
  1243. }
  1244. .time-form .el-form-item {
  1245. margin-bottom: 0 !important;
  1246. }
  1247. ::v-deep .period {
  1248. display: flex;
  1249. .borderleftnone {
  1250. .el-input--medium .el-input__inner {
  1251. border-top-right-radius: 0;
  1252. border-bottom-right-radius: 0;
  1253. }
  1254. }
  1255. .borderrightnone {
  1256. .el-input--medium .el-input__inner {
  1257. border-top-left-radius: 0;
  1258. border-bottom-left-radius: 0;
  1259. }
  1260. }
  1261. }
  1262. ::v-deep .time-form tbody > tr:hover > td {
  1263. background-color: transparent !important;
  1264. }
  1265. ::v-deep .time-form .el-table tr {
  1266. background-color: #ffffff;
  1267. }
  1268. .pricebox {
  1269. display: flex;
  1270. justify-content: flex-start;
  1271. align-items: center;
  1272. font-weight: bold;
  1273. }
  1274. </style>