saleGeneralityInventoryTable.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105
  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="handParent('', -1)"
  22. v-if="!isContractId"
  23. >
  24. 新增
  25. </el-button> -->
  26. </div>
  27. <div class="pricebox">
  28. <span class="amount">总计:{{ allPrice }}元</span>
  29. </div>
  30. </div>
  31. </template>
  32. <template v-slot:productName="{ row, $index }">
  33. <el-form-item
  34. style="margin-bottom: 20px"
  35. :prop="'datasource.' + $index + '.productName'"
  36. :rules="{
  37. required: true,
  38. message: '请输入',
  39. trigger: 'change'
  40. }"
  41. >
  42. <el-input
  43. :disabled="isContractId || row.productCode"
  44. v-model="row.productName"
  45. placeholder="请输入"
  46. style="width: 60%; margin-right: 10px"
  47. ></el-input>
  48. <el-button
  49. size="small"
  50. type="primary"
  51. @click.native="handParent(row, $index)"
  52. >选择
  53. </el-button>
  54. </el-form-item>
  55. </template>
  56. <template v-slot:headerCustomerMark="{ column }">
  57. <span class="is-required">{{ column.label }}</span>
  58. </template>
  59. <template v-slot:customerMark="{ row, $index }">
  60. <el-form-item
  61. :prop="'datasource.' + $index + '.customerMark'"
  62. >
  63. <el-input v-model="row.customerMark" placeholder="请输入"></el-input>
  64. </el-form-item>
  65. </template>
  66. <template v-slot:headerProductName="{ column }">
  67. <span class="is-required">{{ column.label }}</span>
  68. </template>
  69. <template v-slot:productCode="scope">
  70. <el-form-item
  71. style="margin-bottom: 20px"
  72. :prop="'datasource.' + scope.$index + '.productCode'"
  73. >
  74. <el-input v-model="scope.row.productCode" :disabled="true"></el-input>
  75. </el-form-item>
  76. </template>
  77. <template v-slot:productCategoryName="scope">
  78. <el-form-item
  79. style="margin-bottom: 20px"
  80. :prop="'datasource.' + scope.$index + '.productCategoryName'"
  81. >
  82. <el-input v-model="scope.row.productCategoryName" disabled></el-input>
  83. </el-form-item>
  84. </template>
  85. <template v-slot:totalCount="scope">
  86. <el-form-item
  87. style="margin-bottom: 20px"
  88. :prop="'datasource.' + scope.$index + '.totalCount'"
  89. >
  90. <el-input
  91. :disabled="isContractId"
  92. v-model="scope.row.totalCount"
  93. type="number"
  94. placeholder="请输入"
  95. @input="changeCount(scope.row, scope.$index)"
  96. ></el-input>
  97. </el-form-item>
  98. </template>
  99. <template
  100. v-slot:headerTotalCount="{ column }"
  101. v-if="pageName != 'businessOpportunity'"
  102. >
  103. <span class="is-required">{{ column.label }}</span>
  104. </template>
  105. <template
  106. v-slot:headerSingleWeight="{ column }"
  107. v-if="pageName != 'businessOpportunity'"
  108. >
  109. <span :class="{ 'is-required': pricingWay == 2 }">{{
  110. column.label
  111. }}</span>
  112. </template>
  113. <template v-slot:totalPrice="scope">
  114. <el-form-item
  115. style="margin-bottom: 20px"
  116. :prop="'datasource.' + scope.$index + '.totalPrice'"
  117. >
  118. {{ (Number(scope.row.totalPrice) || 0).toFixed(2) }}元
  119. </el-form-item>
  120. </template>
  121. <template v-slot:productBrand="scope">
  122. <el-form-item
  123. style="margin-bottom: 20px"
  124. :prop="'datasource.' + scope.$index + '.productBrand'"
  125. >
  126. <el-input
  127. v-model="scope.row.productBrand"
  128. :disabled="scope.row.productCode"
  129. ></el-input>
  130. </el-form-item>
  131. </template>
  132. <template v-slot:modelType="scope">
  133. <el-form-item
  134. style="margin-bottom: 20px"
  135. :prop="'datasource.' + scope.$index + '.modelType'"
  136. >
  137. <el-input
  138. v-model="scope.row.modelType"
  139. :disabled="scope.row.productCode"
  140. ></el-input>
  141. </el-form-item>
  142. </template>
  143. <template v-slot:specification="scope">
  144. <el-form-item
  145. style="margin-bottom: 20px"
  146. :prop="'datasource.' + scope.$index + '.specification'"
  147. >
  148. <el-input
  149. v-model="scope.row.specification"
  150. :disabled="scope.row.productCode"
  151. ></el-input>
  152. </el-form-item>
  153. </template>
  154. <template v-slot:guaranteePeriod="scope">
  155. <div class="period">
  156. <div class="borderleftnone">
  157. <el-form-item
  158. style="margin-bottom: 20px"
  159. :prop="'datasource.' + scope.$index + '.guaranteePeriod'"
  160. :rules="{
  161. required: true,
  162. pattern: numberReg,
  163. message: '请输入有效期',
  164. trigger: 'blur'
  165. }"
  166. >
  167. <el-input
  168. :disabled="isContractId"
  169. v-model="scope.row.guaranteePeriod"
  170. @change="
  171. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  172. "
  173. placeholder="请输入"
  174. ></el-input>
  175. </el-form-item>
  176. </div>
  177. <div class="borderrightnone">
  178. <DictSelection
  179. dictName="质保期单位"
  180. clearable
  181. v-model="scope.row.guaranteePeriodUnitCode"
  182. :disabled="isContractId"
  183. @change="
  184. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  185. "
  186. >
  187. </DictSelection>
  188. </div>
  189. </div>
  190. </template>
  191. <template v-slot:measuringUnit="scope">
  192. <el-form-item
  193. style="margin-bottom: 20px"
  194. :prop="'datasource.' + scope.$index + '.measuringUnit'"
  195. >
  196. <el-input
  197. v-model="scope.row.measuringUnit"
  198. :disabled="scope.row.productCode"
  199. placeholder="请输入"
  200. ></el-input>
  201. </el-form-item>
  202. </template>
  203. <template v-slot:remark="scope">
  204. <el-form-item
  205. style="margin-bottom: 20px"
  206. :prop="'datasource.' + scope.$index + '.remark'"
  207. >
  208. <el-input
  209. :disabled="isContractId"
  210. v-model="scope.row.remark"
  211. type="textarea"
  212. placeholder="请输入"
  213. ></el-input>
  214. </el-form-item>
  215. </template>
  216. <template v-slot:singlePrice="scope">
  217. <el-form-item
  218. style="margin-bottom: 20px"
  219. :prop="'datasource.' + scope.$index + '.singlePrice'"
  220. >
  221. <el-input
  222. :disabled="isContractId"
  223. v-model="scope.row.singlePrice"
  224. placeholder="请输入"
  225. type="number"
  226. @input="changeCount(scope.row, scope.$index)"
  227. >
  228. <template slot="append">元</template>
  229. </el-input>
  230. </el-form-item>
  231. </template>
  232. <template
  233. v-slot:headerSinglePrice="{ column }"
  234. v-if="pageName != 'businessOpportunity'"
  235. >
  236. <span class="is-required">{{ column.label }}</span>
  237. </template>
  238. <template v-slot:headerCustomerExpectDeliveryDeadline="{ column }">
  239. <span class="is-required">{{ column.label }}</span>
  240. </template>
  241. <template v-slot:technicalAnswerName="{ row, $index }">
  242. <el-form-item
  243. style="margin-bottom: 20px"
  244. :prop="'datasource.' + $index + '.technicalAnswerName'"
  245. >
  246. <el-input
  247. v-model="row.technicalAnswerName"
  248. placeholder="请输入"
  249. :disabled="isContractId"
  250. @click.native="handHead(row, $index)"
  251. ></el-input>
  252. </el-form-item>
  253. </template>
  254. <template v-slot:technicalParams="scope">
  255. <el-form-item
  256. style="margin-bottom: 20px"
  257. :prop="'datasource.' + scope.$index + '.technicalParams'"
  258. >
  259. <el-input
  260. type="textarea"
  261. v-model="scope.row.technicalParams"
  262. :disabled="isContractId"
  263. placeholder="请输入"
  264. ></el-input>
  265. </el-form-item>
  266. </template>
  267. <template v-slot:technicalDrawings="scope">
  268. <el-form-item
  269. style="margin-bottom: 20px"
  270. :prop="'datasource.' + scope.$index + '.technicalDrawings'"
  271. >
  272. <fileMain
  273. v-model="scope.row.technicalDrawings"
  274. :type="isContractId ? 'view' : ''"
  275. ></fileMain>
  276. </el-form-item>
  277. </template>
  278. <template v-slot:customerReqFiles="scope">
  279. <el-form-item
  280. style="margin-bottom: 20px"
  281. :prop="'datasource.' + scope.$index + '.customerReqFiles'"
  282. >
  283. <fileMain
  284. v-model="scope.row.customerReqFiles"
  285. :type="isContractId ? 'view' : ''"
  286. ></fileMain>
  287. </el-form-item>
  288. </template>
  289. <template v-slot:industryArtFiles="scope">
  290. <el-form-item
  291. style="margin-bottom: 20px"
  292. :prop="'datasource.' + scope.$index + '.industryArtFiles'"
  293. :rules="{
  294. required: false,
  295. message: '请输入',
  296. trigger: 'change'
  297. }"
  298. >
  299. <fileMain
  300. v-model="scope.row.industryArtFiles"
  301. :type="isContractId ? 'view' : ''"
  302. ></fileMain>
  303. </el-form-item>
  304. </template>
  305. <template v-slot:otherFiles="scope">
  306. <el-form-item
  307. style="margin-bottom: 20px"
  308. :prop="'datasource.' + scope.$index + '. otherFiles'"
  309. >
  310. <fileMain
  311. v-model="scope.row.otherFiles"
  312. :type="isContractId ? 'view' : ''"
  313. ></fileMain>
  314. </el-form-item>
  315. </template>
  316. <template v-slot:produceDeliveryDeadline="scope">
  317. <el-form-item
  318. :prop="'datasource.' + scope.$index + '.produceDeliveryDeadline'"
  319. >
  320. <el-date-picker
  321. style="width: 140px"
  322. v-model="scope.row.produceDeliveryDeadline"
  323. :disabled="isContractId"
  324. type="date"
  325. placeholder="选择日期"
  326. >
  327. </el-date-picker>
  328. </el-form-item>
  329. </template>
  330. <template v-slot:customerExpectDeliveryDeadline="scope">
  331. <el-form-item
  332. :rules="{
  333. required: true,
  334. message: '请选择客户期望交期',
  335. trigger: 'change'
  336. }"
  337. :prop="
  338. 'datasource.' + scope.$index + '.customerExpectDeliveryDeadline'
  339. "
  340. >
  341. <el-date-picker
  342. style="width: 140px"
  343. :disabled="isContractId"
  344. v-model="scope.row.customerExpectDeliveryDeadline"
  345. type="date"
  346. placeholder="选择日期"
  347. >
  348. </el-date-picker>
  349. </el-form-item>
  350. </template>
  351. <template v-slot:guaranteePeriodDeadline="scope">
  352. <el-form-item
  353. :prop="'datasource.' + scope.$index + '.guaranteePeriodDeadline'"
  354. >
  355. <el-date-picker
  356. style="width: 140px"
  357. :disabled="isContractId"
  358. v-model="scope.row.guaranteePeriodDeadline"
  359. type="date"
  360. placeholder="选择日期"
  361. >
  362. </el-date-picker>
  363. </el-form-item>
  364. </template>
  365. <template v-slot:singleWeight="scope">
  366. <el-form-item
  367. style="margin-bottom: 20px"
  368. :prop="'datasource.' + scope.$index + '.singleWeight'"
  369. >
  370. <el-input
  371. :disabled="isContractId"
  372. v-model="scope.row.singleWeight"
  373. @input="changeCount(scope.row, scope.$index)"
  374. placeholder="请输入"
  375. ></el-input>
  376. </el-form-item>
  377. </template>
  378. <template v-slot:technologyRouteName="scope">
  379. <el-form-item
  380. :prop="'datasource.' + scope.$index + '.technologyRouteName'"
  381. :rules="{
  382. required: false,
  383. message: '请选择',
  384. trigger: 'change'
  385. }"
  386. >
  387. <el-input
  388. v-model="scope.row.technologyRouteName"
  389. :disabled="isContractId"
  390. placeholder="请选择"
  391. @click.native="openVersion(scope.$index)"
  392. ></el-input>
  393. </el-form-item>
  394. </template>
  395. <template v-slot:pricingWay="scope">
  396. <el-form-item :prop="'datasource.' + scope.$index + '.pricingWay'">
  397. <el-select v-model="scope.row.pricingWay" placeholder="请选择">
  398. <el-option
  399. v-for="item in pricingWayList"
  400. :key="item.id"
  401. :label="item.name"
  402. :value="item.id"
  403. @click.native="changeCount(scope.row, scope.$index)"
  404. >
  405. </el-option>
  406. </el-select>
  407. </el-form-item>
  408. </template>
  409. <!-- 操作列 -->
  410. <template v-slot:action="{ row }">
  411. <el-popconfirm
  412. class="ele-action"
  413. title="确定要删除吗?"
  414. @confirm="remove(row)"
  415. >
  416. <template v-slot:reference>
  417. <el-link type="danger" :underline="false" icon="el-icon-delete">
  418. 删除
  419. </el-link>
  420. </template>
  421. </el-popconfirm>
  422. </template>
  423. </ele-pro-table>
  424. <product-list
  425. ref="productListRef"
  426. classType="1"
  427. :is-get-inventory-total="true"
  428. @changeParent="changeParent"
  429. ></product-list>
  430. <head-list ref="headRef" @changeParent="changeAnswer"></head-list>
  431. <ProductionVersion
  432. ref="versionRefs"
  433. @changeProduct="changeProduct"
  434. ></ProductionVersion>
  435. </el-form>
  436. </template>
  437. <script>
  438. import { numberReg } from 'ele-admin';
  439. import productList from '@/BIZComponents/product-list.vue';
  440. import dictMixins from '@/mixins/dictMixins';
  441. import fileUpload from '@/components/upload/fileUpload';
  442. import headList from '@/BIZComponents/user-select/user-select.vue';
  443. import ProductionVersion from '@/components/ProductionVersion2/index.vue';
  444. import { getInventoryTotalAPI } from '@/api/bpm/components/wms/index.js';
  445. import { getByCode } from '@/api/system/dictionary-data';
  446. // import fileMain from '@/components/addDoc/index.vue';
  447. import { pricingWayList,lbjtList } from '@/enum/dict.js';
  448. import { changeCount } from '@/BIZComponents/setProduct.js';
  449. const dayjs = require('dayjs');
  450. export default {
  451. mixins: [dictMixins],
  452. components: {
  453. // fileMain,
  454. productList,
  455. fileUpload,
  456. headList,
  457. ProductionVersion
  458. },
  459. props: {
  460. pageName: {
  461. default: '',
  462. type: String
  463. },
  464. isDiscountTotalPrice: {
  465. default: false,
  466. type: Boolean
  467. },
  468. isDeliveryDeadline: {
  469. default: true,
  470. type: Boolean
  471. },
  472. isGuaranteePeriod: {
  473. default: true,
  474. type: Boolean
  475. },
  476. isCustomerMark: {
  477. default: true,
  478. type: Boolean
  479. },
  480. customerMark: {
  481. default: '',
  482. type: String
  483. },
  484. isContractId: {
  485. type: Boolean,
  486. default: false
  487. },
  488. pricingWay: {
  489. type: [Number, String],
  490. default: 1
  491. },
  492. isDrawer: {
  493. type: Boolean,
  494. default: false
  495. }
  496. },
  497. data() {
  498. const defaultForm = {
  499. key: null,
  500. endTime: '',
  501. isFirst: 0,
  502. name: '',
  503. startTime: '',
  504. workHour: '',
  505. guaranteePeriodUnitCode: '',
  506. technicalDrawings: []
  507. };
  508. return {
  509. allPrice: 0,
  510. discountTotalPrice: 0,
  511. numberReg,
  512. defaultForm,
  513. form: {
  514. datasource: []
  515. },
  516. pricingWayList,
  517. rules: {},
  518. dictList: {},
  519. columns: [
  520. {
  521. width: 45,
  522. type: 'index',
  523. columnKey: 'index',
  524. align: 'center',
  525. fixed: 'left'
  526. },
  527. {
  528. width: 280,
  529. prop: 'productName',
  530. label: '名称',
  531. slot: 'productName',
  532. headerSlot: 'headerProductName',
  533. align: 'center'
  534. },
  535. {
  536. width: 120,
  537. prop: 'productCode',
  538. label: '编码',
  539. slot: 'productCode',
  540. align: 'center'
  541. },
  542. {
  543. width: 200,
  544. prop: 'productCategoryName',
  545. label: '类型',
  546. slot: 'productCategoryName',
  547. align: 'center'
  548. },
  549. {
  550. width: 160,
  551. prop: 'productBrand',
  552. label: '牌号',
  553. slot: 'productBrand',
  554. align: 'center'
  555. },
  556. {
  557. width: 120,
  558. prop: 'modelType',
  559. label: '型号',
  560. slot: 'modelType',
  561. align: 'center'
  562. },
  563. {
  564. width: 120,
  565. prop: 'specification',
  566. label: '规格',
  567. slot: 'specification',
  568. align: 'center'
  569. },
  570. {
  571. width: 120,
  572. prop: 'imgCode',
  573. align: 'center',
  574. label: '图号/件号',
  575. showOverflowTooltip: true
  576. },
  577. {
  578. width: 120,
  579. prop: 'produceType',
  580. align: 'center',
  581. label: '属性类型',
  582. showOverflowTooltip: true,
  583. formatter: (row, column) => {
  584. if(row.produceType){
  585. return row.produceType.map(item=>{
  586. return lbjtList[item]
  587. }).toString()
  588. }
  589. }
  590. },
  591. // {
  592. // width: 120,
  593. // prop: 'approvalNumber',
  594. // align: 'center',
  595. // label: '批准文号',
  596. // showOverflowTooltip: true
  597. // },
  598. {
  599. width: 120,
  600. prop: 'packingSpecification',
  601. align: 'center',
  602. label: '包装规格',
  603. showOverflowTooltip: true
  604. },
  605. {
  606. width: 200,
  607. prop: 'customerMark',
  608. label: '客户代号',
  609. slot: 'customerMark',
  610. align: 'center'
  611. },
  612. {
  613. width: 150,
  614. prop: 'totalCount',
  615. label: '数量',
  616. slot: 'totalCount',
  617. headerSlot: 'headerTotalCount',
  618. align: 'center'
  619. },
  620. {
  621. width: 120,
  622. prop: 'availableCountBase',
  623. label: '库存数量',
  624. slot: 'availableCountBase',
  625. align: 'center'
  626. },
  627. {
  628. width: 120,
  629. prop: 'measuringUnit',
  630. label: '计量单位',
  631. slot: 'measuringUnit',
  632. align: 'center'
  633. },
  634. {
  635. width: 120,
  636. prop: 'singleWeight',
  637. label: '单重',
  638. slot: 'singleWeight',
  639. headerSlot: 'headerSingleWeight',
  640. align: 'center'
  641. },
  642. {
  643. width: 120,
  644. prop: 'totalWeight',
  645. label: '总重',
  646. slot: 'totalWeight',
  647. align: 'center'
  648. },
  649. {
  650. width: 120,
  651. prop: 'weightUnit',
  652. label: '重量单位',
  653. slot: 'weightUnit',
  654. align: 'center'
  655. },
  656. // {
  657. // width: 160,
  658. // prop: 'pricingWay',
  659. // label: '计价方式',
  660. // slot: 'pricingWay',
  661. // align: 'center'
  662. // },
  663. {
  664. width: 200,
  665. prop: 'singlePrice',
  666. label: '单价',
  667. slot: 'singlePrice',
  668. headerSlot: 'headerSinglePrice',
  669. align: 'center'
  670. },
  671. {
  672. width: 120,
  673. prop: 'totalPrice',
  674. label: '合计',
  675. slot: 'totalPrice',
  676. align: 'center'
  677. },
  678. {
  679. width: 160,
  680. prop: 'customerExpectDeliveryDeadline',
  681. label: '客户期望交期',
  682. slot: 'customerExpectDeliveryDeadline',
  683. headerSlot: 'headerCustomerExpectDeliveryDeadline',
  684. align: 'center'
  685. },
  686. {
  687. width: 160,
  688. prop: 'produceDeliveryDeadline',
  689. label: '生产交付交期',
  690. slot: 'produceDeliveryDeadline',
  691. align: 'center'
  692. },
  693. {
  694. width: 200,
  695. prop: 'guaranteePeriod',
  696. label: '有效期',
  697. slot: 'guaranteePeriod',
  698. headerSlot: 'headerCustomerExpectDeliveryDeadline',
  699. align: 'center'
  700. },
  701. {
  702. width: 200,
  703. prop: 'guaranteePeriodDeadline',
  704. label: '有效期截止日期',
  705. slot: 'guaranteePeriodDeadline',
  706. show: this.isGuaranteePeriod,
  707. align: 'center'
  708. },
  709. {
  710. width: 220,
  711. prop: 'customerReqFiles',
  712. label: '客户需求',
  713. slot: 'customerReqFiles',
  714. align: 'center'
  715. },
  716. {
  717. width: 130,
  718. prop: 'technicalAnswerName',
  719. label: '技术答疑人',
  720. slot: 'technicalAnswerName',
  721. align: 'center'
  722. },
  723. {
  724. width: 220,
  725. prop: 'technicalParams',
  726. label: '技术参数',
  727. slot: 'technicalParams',
  728. align: 'center'
  729. },
  730. {
  731. width: 240,
  732. prop: 'technicalDrawings',
  733. label: '技术图纸',
  734. slot: 'technicalDrawings',
  735. align: 'center'
  736. },
  737. {
  738. width: 240,
  739. prop: 'technologyRouteName',
  740. label: '工艺路线',
  741. slot: 'technologyRouteName',
  742. align: 'center'
  743. },
  744. {
  745. width: 240,
  746. prop: 'industryArtFiles',
  747. label: '工艺附件',
  748. slot: 'industryArtFiles',
  749. align: 'center'
  750. },
  751. {
  752. width: 240,
  753. prop: 'otherFiles',
  754. label: '其他附件',
  755. slot: 'otherFiles',
  756. align: 'center'
  757. },
  758. {
  759. width: 220,
  760. prop: 'remark',
  761. label: '备注',
  762. slot: 'remark',
  763. align: 'center'
  764. },
  765. {
  766. columnKey: 'action',
  767. label: '操作',
  768. width: 120,
  769. align: 'center',
  770. resizable: false,
  771. slot: 'action',
  772. fixed: 'right',
  773. showOverflowTooltip: true
  774. }
  775. ]
  776. };
  777. },
  778. computed: {
  779. canHandl() {
  780. return this.form.datasource.length;
  781. }
  782. },
  783. created() {
  784. this.getDictList('productionType');
  785. },
  786. methods: {
  787. getDictV(code, val) {
  788. if (!this.dictList[code]) return '';
  789. return this.dictList[code].find((item) => item.value == val)?.label;
  790. },
  791. async getDictList(code) {
  792. let { data: res } = await getByCode(code);
  793. this.dictList[code] = res.map((item) => {
  794. let values = Object.keys(item);
  795. return {
  796. value: values[0],
  797. label: item[values[0]]
  798. };
  799. });
  800. },
  801. openVersion(index) {
  802. this.$refs.versionRefs.open(index);
  803. },
  804. //工艺路线
  805. changeProduct(data, index) {
  806. this.$set(
  807. this.form.datasource[index],
  808. 'technologyRouteName',
  809. data.name
  810. );
  811. this.$set(this.form.datasource[index], 'technologyRouteId', data.id);
  812. },
  813. setDeliveryDays(row, index, type, isAll) {
  814. if (isAll) {
  815. this.form.datasource.forEach((item, i) => {
  816. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  817. item.guaranteePeriodUnitCode
  818. );
  819. this.$set(
  820. this.form.datasource[i],
  821. 'guaranteePeriodDeadline',
  822. guaranteePeriodUnitName != 'second'
  823. ? this.setDay(item.guaranteePeriod, guaranteePeriodUnitName)
  824. : ''
  825. );
  826. // }
  827. });
  828. return;
  829. }
  830. if (type == 'guaranteePeriod') {
  831. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  832. row.guaranteePeriodUnitCode
  833. );
  834. this.$set(
  835. this.form.datasource[index],
  836. 'guaranteePeriodDeadline',
  837. guaranteePeriodUnitName != 'second'
  838. ? this.setDay(row.guaranteePeriod, guaranteePeriodUnitName)
  839. : ''
  840. );
  841. }
  842. },
  843. guaranteePeriodUnit(code) {
  844. return code == 3
  845. ? 'day'
  846. : code == 4
  847. ? 'month'
  848. : code == 5
  849. ? 'year'
  850. : 'second';
  851. },
  852. setDay(addDay, dateType = 'day') {
  853. return dayjs(this.contractStartDate || new Date())
  854. .add(addDay, dateType)
  855. .format('YYYY-MM-DD');
  856. },
  857. // 返回列表数据
  858. getTableValue() {
  859. let comitDatasource = this.form.datasource;
  860. if (comitDatasource.length === 0) return [];
  861. comitDatasource.forEach((v) => {
  862. if (v.guaranteePeriodUnitCode) {
  863. v.guaranteePeriodUnitName = this.getDictValue(
  864. '保质期单位',
  865. v.guaranteePeriodUnitCode
  866. );
  867. }
  868. v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
  869. v.customerReqFiles = v.customerReqFiles || [];
  870. v.industryArtFiles = v.industryArtFiles || [];
  871. v.otherFiles = v.otherFiles || [];
  872. });
  873. return comitDatasource;
  874. },
  875. getPrice() {
  876. return [this.allPrice, this.form.discountTotalPrice];
  877. },
  878. //改变数量
  879. changeCount(row, index) {
  880. const { allPrice, arr } = changeCount(row, index, this.form.datasource);
  881. this.form.datasource = arr;
  882. this.allPrice = allPrice || 0;
  883. },
  884. setCustomerMark(customerMark) {
  885. this.form.datasource.forEach((item) => {
  886. item['customerMark'] = customerMark;
  887. this.$forceUpdate();
  888. });
  889. },
  890. //修改回显
  891. async putTableValue(data) {
  892. let productList =
  893. (data &&
  894. (data.quoteProductList || data.productList || data.detailList)) ||
  895. [];
  896. if (productList) {
  897. productList.forEach((item) => {
  898. item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode
  899. ? item.guaranteePeriodUnitCode + ''
  900. : '';
  901. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  902. item.guaranteePeriodUnitCode
  903. );
  904. if (item.guaranteePeriod && item.guaranteePeriodUnitCode) {
  905. item['guaranteePeriodDeadline'] =
  906. item['guaranteePeriodDeadline'] ||
  907. guaranteePeriodUnitName != 'second'
  908. ? this.setDay(item.guaranteePeriod, guaranteePeriodUnitName)
  909. : '';
  910. }
  911. });
  912. this.form.datasource = productList;
  913. this.changeCount();
  914. let codeList = this.form.datasource.map((item) => item.productCode);
  915. //获取仓库库存
  916. let inventoryTotalList = await getInventoryTotalAPI(codeList);
  917. this.form.datasource.forEach((item) => {
  918. let find =
  919. inventoryTotalList.find((key) => key.code == item.productCode) ||
  920. {};
  921. item.availableCountBase = find.availableCountBase;
  922. });
  923. this.$refs.table.reload();
  924. }
  925. },
  926. //计算单重
  927. //选择产品
  928. handParent(row, index) {
  929. let item = {
  930. id: row.productCode
  931. };
  932. this.$refs.productListRef.open(item, index);
  933. },
  934. //选择技术人回调
  935. changeAnswer(obj, idx) {
  936. this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
  937. this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
  938. },
  939. handHead(row, index) {
  940. let item = {
  941. id: row.technicalAnswerId
  942. };
  943. this.$refs.headRef.open(item, index);
  944. },
  945. //选择产品回调
  946. changeParent(obj, idx) {
  947. obj.forEach((item, index) => {
  948. let i = idx == -1 ? index : idx;
  949. let row = JSON.parse(JSON.stringify(this.defaultForm));
  950. row.key = this.form.datasource.length + 1;
  951. let parasm = idx == -1 ? row : this.form.datasource[i];
  952. this.$set(parasm, 'productId', item.id);
  953. this.$set(parasm, 'categoryName', item.name);
  954. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  955. this.$set(parasm, 'productBrand', item.brandNum);
  956. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  957. this.$set(parasm, 'productCode', item.code);
  958. this.$set(parasm, 'productName', item.name);
  959. this.$set(parasm, 'modelType', item.modelType);
  960. this.$set(parasm, 'availableCountBase', item.availableCountBase);
  961. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  962. this.$set(parasm, 'specification', item.specification);
  963. this.$set(parasm, 'weightUnit', item.weightUnit);
  964. this.$set(parasm, 'singleWeight', item.roughWeight);
  965. this.$set(parasm, 'pricingWay', 1);
  966. this.$set(parasm, 'imgCode', item.imgCode);
  967. this.$set(parasm, 'produceType', item.componentAttribute);
  968. this.$set(parasm, 'approvalNumber', item.extField.approvalNumber);
  969. this.$set(
  970. parasm,
  971. 'packingSpecification',
  972. item.extField.packingSpecification
  973. );
  974. this.$set(parasm, 'customerMark', this.customerMark);
  975. if (idx == -1) {
  976. this.form.datasource.push(row);
  977. }
  978. });
  979. },
  980. remove(row) {
  981. let index = this.form.datasource.findIndex((n) => n.key == row.key);
  982. if (index !== -1) {
  983. this.form.datasource.splice(index, 1);
  984. this.setSort();
  985. }
  986. },
  987. // 清空表格
  988. restTable() {
  989. this.form.datasource = [];
  990. },
  991. // 重新排序
  992. setSort() {
  993. this.form.datasource.forEach((n, index) => {
  994. n.key = index + 1;
  995. });
  996. },
  997. // 添加
  998. handlAdd() {
  999. let item = JSON.parse(JSON.stringify(this.defaultForm));
  1000. item.key = this.form.datasource.length + 1;
  1001. this.form.datasource.push(item);
  1002. },
  1003. validateForm(callback) {
  1004. //开始表单校验
  1005. this.$refs.form.validate((valid, obj) => {
  1006. if (obj) {
  1007. let messages = Object.keys(obj).map((key) => obj[key][0]);
  1008. if (messages.length > 0) {
  1009. this.$message.warning(messages[0].message);
  1010. }
  1011. }
  1012. callback(valid);
  1013. });
  1014. },
  1015. save() {
  1016. this.$emit('save');
  1017. }
  1018. }
  1019. };
  1020. </script>
  1021. <style lang="scss" scoped>
  1022. .headbox {
  1023. display: flex;
  1024. justify-content: space-between;
  1025. align-items: center;
  1026. .amount {
  1027. font-size: 14px;
  1028. font-weight: bold;
  1029. padding-right: 30px;
  1030. }
  1031. }
  1032. .time-form .el-form-item {
  1033. margin-bottom: 0 !important;
  1034. }
  1035. ::v-deep .period {
  1036. display: flex;
  1037. .borderleftnone {
  1038. .el-input--medium .el-input__inner {
  1039. border-top-right-radius: 0;
  1040. border-bottom-right-radius: 0;
  1041. }
  1042. }
  1043. .borderrightnone {
  1044. .el-input--medium .el-input__inner {
  1045. border-top-left-radius: 0;
  1046. border-bottom-left-radius: 0;
  1047. }
  1048. }
  1049. }
  1050. ::v-deep .time-form tbody > tr:hover > td {
  1051. background-color: transparent !important;
  1052. }
  1053. ::v-deep .time-form .el-table tr {
  1054. background-color: #ffffff;
  1055. }
  1056. .pricebox {
  1057. display: flex;
  1058. justify-content: flex-start;
  1059. align-items: center;
  1060. font-weight: bold;
  1061. }
  1062. </style>