inventoryTable.vue 33 KB

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