inventoryTable.vue 39 KB

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