inventoryTable.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424
  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. :datasource="form.datasource"
  8. class="time-form"
  9. @columns-change="handleColumnChange"
  10. :cache-key="cacheKeyUrl"
  11. :maxHeight="350"
  12. >
  13. <!-- 表头工具栏 -->
  14. <template v-slot:toolbar>
  15. <div class="headbox">
  16. <el-button
  17. v-if="isShowAdd && needProduce != 4"
  18. size="small"
  19. type="primary"
  20. icon="el-icon-plus"
  21. class="ele-btn-icon"
  22. @click="handlAdd"
  23. >
  24. 新增
  25. </el-button>
  26. <el-button
  27. v-if="isShowAdd && needProduce == 4"
  28. size="small"
  29. type="primary"
  30. icon="el-icon-plus"
  31. class="ele-btn-icon"
  32. @click="handParent()"
  33. >
  34. 新增
  35. </el-button>
  36. </div>
  37. </template>
  38. <template v-slot:technicalDrawings="{ row, $index }">
  39. <el-form-item :prop="'datasource.' + $index + '.technicalDrawings'">
  40. <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
  41. </el-form-item>
  42. </template>
  43. <template v-slot:remark="{ row, $index }">
  44. <el-form-item :prop="'datasource.' + $index + '.remark'">
  45. <el-input
  46. clearable
  47. v-model="row.remark"
  48. type="textarea"
  49. placeholder="请输入"
  50. />
  51. </el-form-item>
  52. </template>
  53. <template v-slot:stockLedger="scope">
  54. <el-form-item>
  55. <el-popover
  56. @hide="() => (selection = [])"
  57. placement="right"
  58. width="60%"
  59. trigger="hover"
  60. >
  61. <ele-pro-table
  62. :ref="'childrenTable' + scope.$index"
  63. row-key="id"
  64. max-height="300px"
  65. :selection.sync="selection"
  66. :needPage="false"
  67. :columns="childrenColumns"
  68. :datasource="scope.row.sendProductDetail"
  69. cache-key="stockLedgerRoleTable"
  70. class="time-form"
  71. >
  72. <!-- 表头工具栏 -->
  73. <template v-slot:toolbar="childrenScope">
  74. <div class="headbox">
  75. <el-button
  76. size="small"
  77. type="primary"
  78. icon="el-icon-plus"
  79. class="ele-btn-icon"
  80. @click="stockLedgerSelect(scope.row, scope.$index)"
  81. >
  82. 选择
  83. </el-button>
  84. <el-button
  85. size="small"
  86. type="danger"
  87. icon="el-icon-delete"
  88. class="ele-btn-icon"
  89. :disabled="!selection.length"
  90. @click="stockLedgerRemove(scope.$index)"
  91. >
  92. 删除
  93. </el-button>
  94. </div>
  95. </template>
  96. </ele-pro-table>
  97. <el-button type="text" slot="reference">明细</el-button>
  98. </el-popover>
  99. </el-form-item>
  100. </template>
  101. <template v-slot:packagingStrength="scope">
  102. <el-form-item>
  103. <DictSelection
  104. dict-name="包装强度"
  105. @change="keyChange(scope.$index, scope.row, 'packagingStrength')"
  106. v-model="scope.row.extField.packagingStrength"
  107. ></DictSelection>
  108. </el-form-item>
  109. </template>
  110. <template v-slot:packagingDensity="scope">
  111. <el-form-item>
  112. <DictSelection
  113. dict-name="包装密度"
  114. @change="keyChange(scope.$index, scope.row, 'packagingDensity')"
  115. v-model="scope.row.extField.packagingDensity"
  116. ></DictSelection>
  117. </el-form-item>
  118. </template>
  119. <template v-slot:totalCount="scope">
  120. <el-form-item
  121. :prop="'datasource.' + scope.$index + '.totalCount'"
  122. :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
  123. >
  124. <el-input
  125. v-model="scope.row.totalCount"
  126. @input="(val) => changeCount1(scope.row, scope.$index)"
  127. ></el-input>
  128. </el-form-item>
  129. </template>
  130. <template v-slot:batchNo="scope">
  131. <el-form-item :prop="'datasource.' + scope.$index + '.batchNo'">
  132. <el-input v-model="scope.row.batchNo" v-no-chinese></el-input>
  133. </el-form-item>
  134. </template>
  135. <!-- 生产编号 可编辑 -->
  136. <template v-slot:productionCodes="{ row }">
  137. <el-form-item>
  138. <el-input v-model="row.productionCodes" v-no-chinese></el-input>
  139. </el-form-item>
  140. </template>
  141. <template v-slot:blockCount="scope">
  142. <el-form-item
  143. :prop="'datasource.' + scope.$index + '.blockCount'"
  144. :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
  145. >
  146. <el-input
  147. v-model="scope.row.blockCount"
  148. @input="
  149. (val) => tableHandleKeyUp(scope.row, scope.$index, 'blockCount')
  150. "
  151. ></el-input>
  152. </el-form-item>
  153. </template>
  154. <template v-slot:receiveTotalWeight="scope">
  155. <el-form-item
  156. :prop="'datasource.' + scope.$index + '.receiveTotalWeight'"
  157. >
  158. <el-input-number
  159. :controls="false"
  160. v-model="scope.row.receiveTotalWeight"
  161. @input="changeSendTotalWeight(scope.row, scope.$index)"
  162. style="width: 60%; margin-right: 10px"
  163. >
  164. </el-input-number>
  165. <el-button
  166. size="small"
  167. type="primary"
  168. v-if="entrustedCode"
  169. @click.native="(e) => handleInnerBound(e, scope.row, scope.$index)"
  170. >选择
  171. </el-button>
  172. </el-form-item>
  173. </template>
  174. <template v-slot:sendTotalWeight="scope">
  175. <el-form-item :prop="'datasource.' + scope.$index + '.sendTotalWeight'">
  176. <el-input-number
  177. :controls="false"
  178. v-model="scope.row.sendTotalWeight"
  179. style="width: 100%"
  180. @input="changeSendTotalWeight(scope.row, scope.$index)"
  181. >
  182. </el-input-number>
  183. </el-form-item>
  184. </template>
  185. <template v-slot:increaseTotalWeight="scope">
  186. <el-form-item
  187. :prop="'datasource.' + scope.$index + '.increaseTotalWeight'"
  188. >
  189. <el-input-number
  190. :controls="false"
  191. v-model="scope.row.increaseTotalWeight"
  192. style="width: 100%"
  193. >
  194. </el-input-number>
  195. </el-form-item>
  196. </template>
  197. <template v-slot:warehouseId="scope">
  198. <el-form-item
  199. :prop="'datasource.' + scope.$index + '.warehouseId'"
  200. :rules="[{ required: true, message: '请选择仓库', trigger: 'blur' }]"
  201. >
  202. <el-select
  203. v-model="scope.row.warehouseId"
  204. placeholder="请选择"
  205. @change="warehouseChange(scope.$index, scope.row)"
  206. >
  207. <el-option
  208. v-for="item in scope.row.warehouseList"
  209. :key="item.warehouseId"
  210. :label="item.warehouseName"
  211. :value="item.warehouseId"
  212. >
  213. </el-option>
  214. </el-select>
  215. </el-form-item>
  216. </template>
  217. <template v-slot:singlePrice="scope">
  218. <el-form-item
  219. style="margin-bottom: 20px"
  220. :prop="'datasource.' + scope.$index + '.singlePrice'"
  221. :rules="{
  222. required: true,
  223. message: '请输入正确的单价',
  224. trigger: 'change'
  225. }"
  226. >
  227. <el-input
  228. v-model="scope.row.singlePrice"
  229. placeholder="请输入"
  230. @input="changeCount(scope.row, scope.$index)"
  231. type="number"
  232. >
  233. <template slot="append">元</template>
  234. </el-input>
  235. </el-form-item>
  236. </template>
  237. <template v-slot:notaxSinglePrice="scope">
  238. <el-form-item
  239. style="margin-bottom: 20px"
  240. :prop="'datasource.' + scope.$index + '.notaxSinglePrice'"
  241. >
  242. <el-input
  243. v-model="scope.row.notaxSinglePrice"
  244. placeholder="请输入"
  245. type="number"
  246. >
  247. <template slot="append">元</template>
  248. </el-input>
  249. </el-form-item>
  250. </template>
  251. <template v-slot:singleWeight="scope" v-if="needProduce == 4">
  252. <el-form-item
  253. style="margin-bottom: 20px"
  254. :rules="{
  255. required: false,
  256. pattern: numberReg,
  257. trigger: 'change'
  258. }"
  259. :prop="'datasource.' + scope.$index + '.singleWeight'"
  260. >
  261. <el-input
  262. v-model="scope.row.singleWeight"
  263. placeholder="请输入"
  264. ></el-input>
  265. </el-form-item>
  266. </template>
  267. <template v-slot:headerWarehouseNum="{ column }">
  268. <span class="is-required">{{ column.label }}</span>
  269. </template>
  270. <template v-slot:headerWarehouseId="{ column }">
  271. <span class="is-required">{{ column.label }}</span>
  272. </template>
  273. <template v-slot:headerTotalCount="{ column }">
  274. <span class="is-required">{{ column.label }}</span>
  275. </template>
  276. <template v-slot:headerReceiveTotalWeight="{ column }">
  277. <span :class="{ 'is-required': entrustedCode && pricingWay == 2 }">{{
  278. column.label
  279. }}</span>
  280. </template>
  281. <template v-slot:saleCount="scope">
  282. <el-form-item
  283. style="margin-bottom: 20px"
  284. :prop="'datasource.' + scope.$index + '.saleCount'"
  285. :rules="{
  286. required: true,
  287. message: '请输入数量',
  288. trigger: 'change'
  289. }"
  290. >
  291. <el-input
  292. v-model="scope.row.saleCount"
  293. placeholder="请输入"
  294. type="number"
  295. :min="0"
  296. @input="changeCount(scope.row, scope.$index)"
  297. >
  298. </el-input>
  299. </el-form-item>
  300. </template>
  301. <template v-slot:saleUnit="scope">
  302. <el-form-item
  303. style="margin-bottom: 20px"
  304. :prop="'datasource.' + scope.$index + '.saleUnitId'"
  305. >
  306. <el-select
  307. v-model="scope.row.saleUnitId"
  308. style="width: 100%"
  309. @change="changeCount(scope.row, scope.$index)"
  310. >
  311. <el-option
  312. :label="item.conversionUnit"
  313. :value="item.id"
  314. @click.native="packingChange(item, scope.$index)"
  315. v-for="(item, index) in scope.row.packageDispositionList"
  316. :key="index"
  317. ></el-option>
  318. </el-select>
  319. </el-form-item>
  320. </template>
  321. <!-- 操作列 -->
  322. <template v-slot:action="scope">
  323. <el-popconfirm
  324. class="ele-action"
  325. title="确定要删除吗?"
  326. @confirm="remove(scope.$index)"
  327. >
  328. <template v-slot:reference>
  329. <el-link type="danger" :underline="false" icon="el-icon-delete">
  330. 删除
  331. </el-link>
  332. </template>
  333. </el-popconfirm>
  334. <el-link
  335. type="primary"
  336. :underline="false"
  337. icon="el-icon-edit"
  338. @click="selectStockLedgerDialogOpen(scope.row)"
  339. >
  340. 替代料
  341. </el-link>
  342. </template>
  343. </ele-pro-table>
  344. <product-list
  345. ref="productListRef"
  346. :orderId="orderId"
  347. @changeParent="changeParent"
  348. ></product-list>
  349. <!--入库详情-->
  350. <innertboundDetailsDialog
  351. v-if="innerboundDetailsDialogFlag"
  352. ref="innerboundDetailsDialogRef"
  353. :innerboundDetailsDialogFlag.sync="innerboundDetailsDialogFlag"
  354. @saveDate="saveInnerDate"
  355. ></innertboundDetailsDialog>
  356. <!-- 库存台账 -->
  357. <stock-ledger-dialog
  358. v-if="stockLedgerDialogFlag"
  359. :stock-ledger-dialog-flag.sync="stockLedgerDialogFlag"
  360. ref="stockLedgerDialogRef"
  361. @getStockLedger="getStockLedger"
  362. ></stock-ledger-dialog>
  363. <selectStockLedgerDialog
  364. ref="selectStockLedgerDialogRef"
  365. @changeParent="replaceTable"
  366. ></selectStockLedgerDialog>
  367. <BIZproductList
  368. ref="BIZproductListRef"
  369. classType="1"
  370. :isGetInventoryTotal="true"
  371. @changeParent="changeParentBiz"
  372. :typeIds="typeIds"
  373. :isFirstRefreshTable="true"
  374. ></BIZproductList>
  375. </el-form>
  376. </template>
  377. <script>
  378. import { numberReg } from 'ele-admin';
  379. import dictMixins from '@/mixins/dictMixins';
  380. import productList from './product-list.vue';
  381. import {
  382. getWarehouseList,
  383. getWarehouseOutStock,
  384. getIdWarehouseList
  385. } from '@/api/saleManage/saleorder';
  386. import { copyObj } from '@/utils/util';
  387. import { getFile } from '@/api/system/file';
  388. import innertboundDetailsDialog from '@/BIZComponents/innerboundDetailsDialog.vue';
  389. import stockLedgerDialog from './stockLedger/stockLedgerDialog.vue';
  390. import getDynamicsColumns from '@/mixins/getDynamicsColumns';
  391. // import fileMain from '@/components/addDoc/index.vue';
  392. import selectStockLedgerDialog from '@/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue'; //库存台账
  393. import BIZproductList from '@/BIZComponents/product-list.vue';
  394. import { lbjtList } from '@/enum/dict.js';
  395. import tabMixins from '@/mixins/tableColumnsMixin';
  396. import { levelList } from '@/enum/dict.js';
  397. import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
  398. export default {
  399. mixins: [dictMixins, getDynamicsColumns, tabMixins],
  400. props: {
  401. orderId: String,
  402. orderIds: String,
  403. needProduce: [String, Number],
  404. entrustedCode: String,
  405. pricingWay: [String, Number],
  406. isShowAdd: {
  407. type: Boolean,
  408. default: true
  409. },
  410. typeIds: {
  411. type: Array,
  412. default: () => []
  413. },
  414. isTotalCount: {
  415. default: 0
  416. }
  417. },
  418. components: {
  419. // fileMain,
  420. innertboundDetailsDialog,
  421. productList,
  422. stockLedgerDialog,
  423. selectStockLedgerDialog,
  424. BIZproductList
  425. },
  426. data() {
  427. const defaultForm = {
  428. key: null,
  429. endTime: '',
  430. isFirst: 0,
  431. name: '',
  432. startTime: '',
  433. workHour: '',
  434. technicalDrawings: []
  435. // warehouseCode:"",
  436. // warehouseId:'',
  437. // warehouseName:'',
  438. };
  439. return {
  440. cacheKeyUrl: 'eos-saleManage-invoice-inventoryTable',
  441. current: {},
  442. childrenColumns: [
  443. {
  444. width: 45,
  445. type: 'selection',
  446. columnKey: 'selection',
  447. align: 'center'
  448. },
  449. {
  450. width: 45,
  451. type: 'index',
  452. columnKey: 'index',
  453. align: 'center',
  454. fixed: 'left'
  455. },
  456. {
  457. minWidth: 100,
  458. prop: 'code',
  459. label: '编码',
  460. align: 'center'
  461. },
  462. {
  463. minWidth: 140,
  464. prop: 'barcodes',
  465. label: '发货条码',
  466. align: 'center'
  467. },
  468. {
  469. minWidth: 100,
  470. prop: 'engrave',
  471. label: '刻码',
  472. align: 'center'
  473. }
  474. ],
  475. selection: [],
  476. discountTotalPrice: 0.0,
  477. allPrice: 0.0,
  478. curIndex: null,
  479. innerboundDetailsDialogFlag: false,
  480. stockLedgerDialogFlag: false,
  481. numberReg,
  482. defaultForm,
  483. warehouseList: [],
  484. dynamicsColumns: [],
  485. form: {
  486. datasource: []
  487. },
  488. rules: {},
  489. };
  490. },
  491. created() {
  492. this.requestDict('产地');
  493. this.requestDict('生产类型');
  494. },
  495. computed: {
  496. canHandl() {
  497. return this.form.datasource.length;
  498. },
  499. contractId() {
  500. return this.$store.state.order.contractId;
  501. },
  502. clientEnvironmentId() {
  503. return this.$store.state.user.info.clientEnvironmentId;
  504. },
  505. columns() {
  506. return [
  507. {
  508. width: 45,
  509. type: 'index',
  510. columnKey: 'index',
  511. align: 'center',
  512. fixed: 'left'
  513. },
  514. {
  515. minWidth: 150,
  516. prop: 'orderNo',
  517. label: '订单编码',
  518. align: 'center',
  519. fixed: 'left'
  520. },
  521. {
  522. width: 200,
  523. prop: 'productName',
  524. label: '名称',
  525. slot: 'productName',
  526. align: 'center'
  527. },
  528. {
  529. width: 120,
  530. prop: 'productCode',
  531. label: '编码',
  532. slot: 'productCode',
  533. align: 'center'
  534. },
  535. {
  536. width: 200,
  537. prop: 'productCategoryName',
  538. label: '类型',
  539. slot: 'productCategoryName',
  540. align: 'center'
  541. },
  542. {
  543. width: 160,
  544. prop: 'batchNo',
  545. label: '批次号',
  546. slot: 'batchNo',
  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. minWidth: 160,
  572. prop: 'productionCodes',
  573. label: '生产编号',
  574. align: 'center',
  575. slot: 'productionCodes'
  576. },
  577. {
  578. minWidth: 120,
  579. prop: 'goodsLevel',
  580. label: '物品级别',
  581. formatter: (_row, _column, cellValue) => {
  582. return levelList.find((item) => item.value == _row.goodsLevel)
  583. ?.label;
  584. },
  585. align: 'center'
  586. },
  587. ...this.dynamicsColumns,
  588. {
  589. width: 120,
  590. prop: 'customerMark',
  591. label: '客户代号',
  592. slot: 'customerMark',
  593. align: 'center'
  594. },
  595. {
  596. width: 200,
  597. prop: 'warehouseId',
  598. label: '仓库名称',
  599. slot: 'warehouseId',
  600. headerSlot: 'headerWarehouseId',
  601. align: 'center'
  602. },
  603. {
  604. width: 100,
  605. prop: 'warehouseNum',
  606. label: '库存',
  607. align: 'center',
  608. slot: 'warehouseNum'
  609. },
  610. // {
  611. // width: 100,
  612. // prop: 'stockLedger',
  613. // label: '发货明细',
  614. // slot: 'stockLedger',
  615. // align: 'center'
  616. // },
  617. {
  618. width: 150,
  619. prop: 'saleCount',
  620. label: '数量',
  621. slot: 'saleCount',
  622. headerSlot: 'headerTotalCount',
  623. align: 'center'
  624. },
  625. {
  626. width: 150,
  627. prop: 'saleUnit',
  628. label: '单位',
  629. slot: 'saleUnit',
  630. align: 'center'
  631. },
  632. {
  633. width: 120,
  634. prop: 'packingSpecification',
  635. align: 'center',
  636. label: '包装规格',
  637. showOverflowTooltip: true
  638. },
  639. {
  640. width: 120,
  641. prop: 'totalCount',
  642. label: '发货数量',
  643. // slot: 'totalCount',
  644. // headerSlot: 'headerTotalCount',
  645. align: 'center'
  646. },
  647. {
  648. width: 120,
  649. prop: 'orderTotalCount',
  650. label: '订单数量',
  651. slot: 'orderTotalCount',
  652. align: 'center'
  653. },
  654. {
  655. width: 80,
  656. prop: 'measuringUnit',
  657. label: '计量单位',
  658. slot: 'measuringUnit',
  659. align: 'center'
  660. },
  661. {
  662. width: 120,
  663. prop: 'blockCount',
  664. label: '发货块数',
  665. slot: 'blockCount',
  666. align: 'center',
  667. show: this.clientEnvironmentId == '4'
  668. },
  669. {
  670. width: 120,
  671. prop: 'singleWeight',
  672. label: '单重',
  673. slot: 'singleWeight',
  674. align: 'center'
  675. },
  676. {
  677. width: 200,
  678. prop: 'receiveTotalWeight',
  679. label: '收货总重',
  680. slot: 'receiveTotalWeight',
  681. align: 'center',
  682. headerSlot: 'headerReceiveTotalWeight'
  683. },
  684. {
  685. width: 100,
  686. prop: 'sendTotalWeight',
  687. label: '发货总重',
  688. slot: 'sendTotalWeight',
  689. align: 'center'
  690. },
  691. {
  692. width: 100,
  693. prop: 'increaseTotalWeight',
  694. label: '增重重量',
  695. slot: 'increaseTotalWeight',
  696. align: 'center'
  697. },
  698. {
  699. width: 100,
  700. prop: 'weightUnit',
  701. label: '重量单位',
  702. slot: 'weightUnit',
  703. align: 'center'
  704. },
  705. // {
  706. // width: 160,
  707. // prop: 'pricingWay',
  708. // label: '计价方式',
  709. // slot: 'pricingWay',
  710. // align: 'center',
  711. // formatter: (row, column) => {
  712. // return row.pricingWay == 1
  713. // ? '按数量计费'
  714. // : row.pricingWay == 2
  715. // ? '按重量计费'
  716. // : '';
  717. // }
  718. // },
  719. {
  720. width: 180,
  721. prop: 'singlePrice',
  722. label: '单价',
  723. slot: 'singlePrice',
  724. align: 'center'
  725. },
  726. {
  727. width: 160,
  728. prop: 'taxRate',
  729. label: '税率',
  730. formatter: (_row, _column, cellValue) => {
  731. return _row.taxRate ? _row.taxRate + '%' : '';
  732. },
  733. align: 'center'
  734. },
  735. {
  736. width: 180,
  737. prop: 'notaxSinglePrice',
  738. label: '不含税单价',
  739. align: 'center'
  740. },
  741. {
  742. width: 160,
  743. prop: 'discountSinglePrice',
  744. label: '折后单价',
  745. slot: 'discountSinglePrice',
  746. align: 'center'
  747. },
  748. {
  749. width: 120,
  750. prop: 'totalPrice',
  751. label: '合计',
  752. slot: 'totalPrice',
  753. align: 'center'
  754. },
  755. {
  756. width: 160,
  757. prop: 'notaxTotalPrice',
  758. label: '含税合计',
  759. align: 'center'
  760. },
  761. {
  762. width: 120,
  763. prop: 'discountTotalPrice',
  764. label: '折后合计',
  765. slot: 'discountTotalPrice',
  766. align: 'center'
  767. },
  768. {
  769. width: 120,
  770. prop: 'imgCode',
  771. align: 'center',
  772. label: '图号/件号',
  773. showOverflowTooltip: true
  774. },
  775. {
  776. width: 120,
  777. prop: 'produceType',
  778. align: 'center',
  779. label: '属性类型',
  780. formatter: (row, column) => {
  781. if (row.produceType) {
  782. return row.produceType
  783. .map((item) => {
  784. return lbjtList[item];
  785. })
  786. .toString();
  787. }
  788. },
  789. showOverflowTooltip: true
  790. },
  791. // {
  792. // width: 80,
  793. // prop: 'deliveryDays',
  794. // label: '交期(天)',
  795. // slot: 'deliveryDays',
  796. // align: 'center'
  797. // },
  798. {
  799. width: 200,
  800. prop: 'guaranteePeriod',
  801. label: '有效期',
  802. slot: 'guaranteePeriod',
  803. formatter: (_row, _column, cellValue) => {
  804. let val = '';
  805. if (_row.guaranteePeriod) {
  806. val += _row.guaranteePeriod;
  807. }
  808. if (_row.guaranteePeriodUnitName) {
  809. val += _row.guaranteePeriodUnitName;
  810. }
  811. return val;
  812. },
  813. align: 'center'
  814. },
  815. {
  816. width: 200,
  817. prop: 'guaranteePeriodDeadline',
  818. label: '有效期截止日期',
  819. slot: 'guaranteePeriodDeadline',
  820. align: 'center'
  821. },
  822. {
  823. prop: 'provenance',
  824. label: '产地',
  825. slot: 'provenance',
  826. align: 'center',
  827. // show:this.contractBookType==2,
  828. minWidth: 200,
  829. showOverflowTooltip: true,
  830. formatter: (row, column) => {
  831. return row.provenance && row.provenance.length
  832. ? row.provenance
  833. .map((item) => this.getDictValue('产地', item))
  834. .join(',')
  835. : '';
  836. }
  837. },
  838. {
  839. width: 130,
  840. prop: 'technicalAnswerName',
  841. label: '技术答疑人',
  842. slot: 'technicalAnswerName',
  843. align: 'center'
  844. },
  845. {
  846. width: 220,
  847. prop: 'technicalParams',
  848. label: '技术参数',
  849. slot: 'technicalParams',
  850. align: 'center'
  851. },
  852. {
  853. width: 240,
  854. prop: 'technicalDrawings',
  855. label: '技术图纸',
  856. slot: 'technicalDrawings',
  857. align: 'center'
  858. },
  859. {
  860. width: 220,
  861. prop: 'remark',
  862. label: '备注',
  863. slot: 'remark',
  864. align: 'center'
  865. },
  866. {
  867. columnKey: 'action',
  868. label: '操作',
  869. width: 180,
  870. align: 'center',
  871. resizable: false,
  872. slot: 'action',
  873. fixed: 'right',
  874. showOverflowTooltip: true
  875. }
  876. ];
  877. }
  878. },
  879. methods: {
  880. downloadFile(file) {
  881. getFile({ objectName: file.storePath }, file.name);
  882. },
  883. //发货明细选择
  884. stockLedgerSelect(row, index) {
  885. this.curIndex = index;
  886. this.stockLedgerDialogFlag = true;
  887. this.$nextTick(() => {
  888. this.$refs.stockLedgerDialogRef.init(row.sendProductDetail, row);
  889. });
  890. },
  891. changeCount1(row, index) {
  892. this.tableHandleKeyUp(row, index, 'sum');
  893. this.changeCount(row, index);
  894. },
  895. packingChange(item, index) {
  896. this.$set(this.form.datasource[index], 'saleUnit', item.conversionUnit);
  897. },
  898. //改变数量
  899. // changeCount() {
  900. // this.form.datasource.forEach((item, index) => {
  901. // if (item.pricingWay == 1) {
  902. // this.$set(
  903. // this.form.datasource[index],
  904. // 'discountTotalPrice',
  905. // item.discountSinglePrice * item.totalCount
  906. // );
  907. // this.$set(
  908. // this.form.datasource[index],
  909. // 'totalPrice',
  910. // item.singlePrice * item.totalCount
  911. // );
  912. // }
  913. // if (item.pricingWay == 2) {
  914. // this.$set(
  915. // this.form.datasource[index],
  916. // 'discountTotalPrice',
  917. // item.discountSinglePrice *
  918. // item.totalCount *
  919. // (item.singleWeight || 0)
  920. // );
  921. // this.$set(
  922. // this.form.datasource[index],
  923. // 'totalPrice',
  924. // item.singlePrice * item.totalCount * (item.singleWeight || 0)
  925. // );
  926. // }
  927. // });
  928. // },
  929. //获取
  930. getStockLedger(sendProductDetail) {
  931. if (!this.form.datasource[this.curIndex].sendProductDetail)
  932. this.form.datasource[this.curIndex].sendProductDetail = [];
  933. let row = this.form.datasource[this.curIndex];
  934. row.sendProductDetail.push(...sendProductDetail);
  935. this.form.datasource[this.curIndex] = row;
  936. this.$refs['childrenTable' + this.curIndex].reload();
  937. this.$refs.table.reload();
  938. },
  939. //删除发货明细
  940. stockLedgerRemove(PIndex) {
  941. let row = this.form.datasource[PIndex];
  942. this.selection.forEach((item) => {
  943. let index = row.sendProductDetail.findIndex((i) => i.id == item.id);
  944. row.sendProductDetail.splice(index, 1);
  945. });
  946. this.form.datasource[PIndex] = row;
  947. this.$refs['childrenTable' + PIndex].reload();
  948. this.$refs.table.reload();
  949. this.selection = [];
  950. },
  951. async warehouseChange(index, row) {
  952. const data = row.warehouseList.find(
  953. (item) => item.warehouseId == row.warehouseId
  954. );
  955. this.$set(
  956. this.form.datasource[index],
  957. 'warehouseName',
  958. data.warehouseName
  959. );
  960. this.$set(
  961. this.form.datasource[index],
  962. 'warehouseCode',
  963. data.warehouseCode
  964. );
  965. const warehouseOutStock = await getWarehouseOutStock({
  966. warehouseId: data.warehouseId,
  967. code: row.productCode
  968. });
  969. this.$set(
  970. this.form.datasource[index],
  971. 'warehouseNum',
  972. warehouseOutStock || 0
  973. );
  974. },
  975. //改变数量
  976. changeCount(row, index) {
  977. this.$set(
  978. this.form,
  979. 'datasource[' + index + ']',
  980. changeCount(row, {
  981. countKey: 'saleCount',
  982. unitKey: 'saleUnit',
  983. unitIdKey: 'saleUnitId'
  984. })
  985. );
  986. this.$set(
  987. this.form.datasource[index],
  988. 'sendTotalWeight',
  989. this.form.datasource[index].totalWeight
  990. );
  991. this.changeSendTotalWeight(row, index);
  992. this.getNotaxSinglePrice();
  993. this.$forceUpdate();
  994. },
  995. //修改发货总重
  996. changeSendTotalWeight(row, index) {
  997. this.curIndex = index;
  998. this.setIcreaseTotalWeight(row);
  999. },
  1000. keyChange(index, row, key) {
  1001. this.$set(
  1002. this.form.datasource[index],
  1003. 'extField.' + key,
  1004. row.extField[key]
  1005. );
  1006. this.$forceUpdate();
  1007. },
  1008. //设置增重总重
  1009. setIcreaseTotalWeight(row) {
  1010. let receiveTotalWeight = Number(
  1011. this.form.datasource[this.curIndex]?.receiveTotalWeight
  1012. );
  1013. let sendTotalWeight = Number(
  1014. this.form.datasource[this.curIndex]?.sendTotalWeight
  1015. );
  1016. if (sendTotalWeight && receiveTotalWeight) {
  1017. this.$set(
  1018. this.form.datasource[this.curIndex],
  1019. 'increaseTotalWeight',
  1020. (sendTotalWeight - receiveTotalWeight).toFixed(2)
  1021. );
  1022. }
  1023. this.$refs.table.reload();
  1024. this.$forceUpdate();
  1025. },
  1026. //计算不含税单价
  1027. getNotaxSinglePrice() {
  1028. this.form.datasource.forEach((item, index) => {
  1029. if (item.singlePrice && item.taxRate) {
  1030. this.$set(
  1031. this.form.datasource[index],
  1032. 'notaxSinglePrice',
  1033. parseFloat(
  1034. (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
  1035. )
  1036. );
  1037. } else {
  1038. this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
  1039. }
  1040. });
  1041. },
  1042. //入库单详情
  1043. handleInnerBound(e, rows, index) {
  1044. this.curIndex = index;
  1045. this.innerboundDetailsDialogFlag = true;
  1046. this.$nextTick(() => {
  1047. let row = {
  1048. code: this.entrustedCode
  1049. };
  1050. this.$refs.innerboundDetailsDialogRef.init(row);
  1051. });
  1052. },
  1053. //选择入库单信息
  1054. saveInnerDate(data = []) {
  1055. let totalWeight = data.reduce((num, row) => {
  1056. num += Number(row.weight);
  1057. return num;
  1058. }, 0);
  1059. this.$set(
  1060. this.form.datasource[this.curIndex],
  1061. 'receiveTotalWeight',
  1062. totalWeight
  1063. );
  1064. console.log(totalWeight, 'totalWeight');
  1065. this.setIcreaseTotalWeight(this.form.datasource[this.curIndex]);
  1066. },
  1067. // getWeightPrice() {
  1068. // let increaseTotalWeight =
  1069. // this.form.datasource[this.curIndex].increaseTotalWeight;
  1070. // let singlePrice = this.form.datasource[this.curIndex].singlePrice;
  1071. // let discountSinglePrice =
  1072. // this.form.datasource[this.curIndex].discountSinglePrice;
  1073. // this.$set(
  1074. // this.form.datasource[this.curIndex],
  1075. // 'totalPrice',
  1076. // (Number(increaseTotalWeight) * Number(singlePrice)).toFixed(2)
  1077. // );
  1078. // this.$set(
  1079. // this.form.datasource[this.curIndex],
  1080. // 'discountTotalPrice',
  1081. // (Number(discountSinglePrice) * Number(increaseTotalWeight)).toFixed(2)
  1082. // );
  1083. // },
  1084. // 表格:模数、数量(方)、块数输入框 输入事件
  1085. tableHandleKeyUp(row, index, name) {
  1086. if (row.specification) {
  1087. let modelArr = row.specification.split('*');
  1088. let modelLong = modelArr[0]; // model规格长度
  1089. let modeWide = modelArr[1]; // model规格宽度
  1090. let modeHight = modelArr[2].substr(0, modelArr[2].indexOf('cm')); // model规格高度
  1091. modeHight = Number(modeHight);
  1092. if (name === 'sum') {
  1093. row.blockCount = Math.floor(
  1094. row.totalCount / ((modelLong * modeWide * modeHight) / 1000000)
  1095. );
  1096. } else if (name === 'blockCount') {
  1097. row.totalCount =
  1098. (Number(row.blockCount) * modelLong * modeWide * modeHight) /
  1099. 1000000;
  1100. this.changeCount(row, index);
  1101. }
  1102. }
  1103. },
  1104. //选择产品回调
  1105. async changeParent(obj, idx) {
  1106. obj.orderTotalCount = obj.totalCount;
  1107. obj.id = '';
  1108. obj['tempId'] = idx;
  1109. this.$set(
  1110. this.form.datasource,
  1111. this.form.datasource.length,
  1112. copyObj(obj)
  1113. );
  1114. },
  1115. //选择产品回调
  1116. changeParentBiz(obj = [], idx) {
  1117. obj.forEach(async (item, index) => {
  1118. let i = idx == -1 ? index : idx;
  1119. let row = JSON.parse(JSON.stringify(this.defaultForm));
  1120. row.key = this.form.datasource.length + 1;
  1121. let parasm = idx == -1 ? row : this.form.datasource[i];
  1122. this.$set(parasm, 'productId', item.id);
  1123. this.$set(parasm, 'categoryName', item.name);
  1124. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  1125. this.$set(parasm, 'productBrand', item.brandNum);
  1126. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  1127. this.$set(parasm, 'productCode', item.code);
  1128. this.$set(parasm, 'productName', item.name);
  1129. this.$set(parasm, 'modelType', item.modelType);
  1130. this.$set(parasm, 'availableCountBase', item.availableCountBase);
  1131. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  1132. this.$set(parasm, 'specification', item.specification);
  1133. this.$set(parasm, 'weightUnit', item.weightUnit);
  1134. this.$set(parasm, 'imgCode', item.imgCode);
  1135. this.$set(parasm, 'produceType', item.componentAttribute);
  1136. this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
  1137. this.$set(parasm, 'extField', item.extField || {});
  1138. this.$set(parasm, 'singleWeight', item.netWeight);
  1139. this.$set(parasm, 'pricingWay', item.pricingWay || 1);
  1140. this.$set(parasm, 'singlePrice', 0);
  1141. this.$set(parasm, 'discountSinglePrice', 0);
  1142. this.$set(parasm, 'receiveTotalWeight', 0);
  1143. this.$set(parasm, 'sendTotalWeight', 0);
  1144. this.$set(parasm, 'increaseTotalWeight', 0);
  1145. this.$set(
  1146. parasm,
  1147. 'warehouseList',
  1148. await getIdWarehouseList({
  1149. categoryId: item.id
  1150. })
  1151. );
  1152. this.$set(
  1153. parasm,
  1154. 'packingSpecification',
  1155. item.extField?.packingSpecification
  1156. );
  1157. this.$set(
  1158. parasm,
  1159. 'supplierMark',
  1160. this.form.datasource[0]?.supplierMark
  1161. );
  1162. if (item.purchaseOrigins?.length > 0) {
  1163. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  1164. }
  1165. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  1166. if (idx == -1) {
  1167. this.form.datasource.push(row);
  1168. }
  1169. });
  1170. },
  1171. replaceTable(list) {
  1172. list.forEach((item) => {
  1173. item['relationId'] = this.current.tempId;
  1174. });
  1175. this.$emit('replaceTableChange', list);
  1176. },
  1177. // validateTotalCount(row) {
  1178. // return (rule, value, callback) => {
  1179. // if (isNaN(value) || Number(value) <= 0) {
  1180. // this.$message.error('请输入大于0的数');
  1181. // callback(false);
  1182. // } else else {
  1183. // callback();
  1184. // }
  1185. // };
  1186. // },
  1187. // 返回列表数据
  1188. getTableValue() {
  1189. let comitDatasource = this.form.datasource;
  1190. if (comitDatasource.length === 0) return [];
  1191. comitDatasource.forEach(async (v) => {
  1192. v.totalCount = Number(v.totalCount);
  1193. v.technicalDrawings = Array.isArray(v.technicalDrawings)
  1194. ? v.technicalDrawings
  1195. : [];
  1196. v.customerReqFiles = Array.isArray(v.customerReqFiles)
  1197. ? v.customerReqFiles
  1198. : [];
  1199. v.industryArtFiles = v.industryArtFiles || [];
  1200. v.otherFiles = v.otherFiles || [];
  1201. });
  1202. return comitDatasource;
  1203. },
  1204. getPrice() {
  1205. return [this.allPrice];
  1206. },
  1207. //修改回显
  1208. putTableValue(data) {
  1209. console.log(data, 'data 1+1');
  1210. if (data) {
  1211. this.form.datasource = data;
  1212. this.form.datasource.forEach(async (item, index) => {
  1213. // if (!item.extField) {
  1214. // this.$set(
  1215. // this.form.datasource[index],
  1216. // 'extField',
  1217. // item.extField || {}
  1218. // );
  1219. // }
  1220. this.$set(
  1221. this.form.datasource[index],
  1222. 'warehouseList',
  1223. await getIdWarehouseList({
  1224. categoryId: item.productId
  1225. })
  1226. );
  1227. if (item.warehouseId) {
  1228. this.$set(
  1229. this.form.datasource[index],
  1230. 'warehouseNum',
  1231. await getWarehouseOutStock({
  1232. warehouseId: item.warehouseId,
  1233. code: item.productCode
  1234. })
  1235. );
  1236. } else if (this.form.datasource[index]?.warehouseList?.length) {
  1237. this.$set(
  1238. this.form.datasource[index],
  1239. 'warehouseId',
  1240. this.form.datasource[index]?.warehouseList[0].warehouseId
  1241. );
  1242. await this.warehouseChange(index, this.form.datasource[index]);
  1243. }
  1244. this.$set(
  1245. this.form.datasource[index],
  1246. 'receiveTotalWeight',
  1247. item.receiveTotalWeight || 0
  1248. );
  1249. if (item.weightUnit == item.measuringUnit) {
  1250. item.sendTotalWeight = item.sendTotalWeight || item.totalCount;
  1251. } else {
  1252. item.sendTotalWeight =
  1253. item.sendTotalWeight ||
  1254. Number(item.totalCount) * Number(item.singleWeight) ||
  1255. 0;
  1256. }
  1257. if (this.outsourceSendCode) {
  1258. item.increaseTotalWeight =
  1259. Number(item.receiveTotalWeight) - Number(item.sendTotalWeight);
  1260. item.increaseTotalWeight;
  1261. } else {
  1262. item.increaseTotalWeight =
  1263. item.increaseTotalWeight || item.receiveTotalWeight || 0;
  1264. }
  1265. this.$set(
  1266. this.form.datasource[index],
  1267. 'sendTotalWeight',
  1268. item.sendTotalWeigh
  1269. );
  1270. this.$set(
  1271. this.form.datasource[index],
  1272. 'increaseTotalWeight',
  1273. item.increaseTotalWeight
  1274. );
  1275. console.log(item.increaseTotalWeight);
  1276. });
  1277. //保存初始收货总重
  1278. this.oldReceiveTotalWeight = this.form.datasource.map((item) => {
  1279. return {
  1280. productCode: item.productCode,
  1281. oldReceiveTotalWeight: item.receiveTotalWeight
  1282. };
  1283. });
  1284. }
  1285. },
  1286. remove(i) {
  1287. this.form.datasource.splice(i, 1);
  1288. this.setSort();
  1289. },
  1290. // 重新排序
  1291. setSort() {
  1292. this.form.datasource.forEach((n, index) => {
  1293. n.key = index + 1;
  1294. });
  1295. },
  1296. //选择产品
  1297. handParent() {
  1298. if (!this.orderId && !this.orderIds)
  1299. return this.$message.error('请先选择订单');
  1300. this.$refs.BIZproductListRef.open('', -1);
  1301. },
  1302. // 添加
  1303. handlAdd() {
  1304. if (!this.orderId && !this.orderIds)
  1305. return this.$message.error('请先选择订单');
  1306. this.$refs.productListRef.open(this.form.datasource);
  1307. },
  1308. //库存台账
  1309. selectStockLedgerDialogOpen(row) {
  1310. this.current = row;
  1311. this.$refs.selectStockLedgerDialogRef.open();
  1312. },
  1313. validateForm(callback) {
  1314. //开始表单校验
  1315. this.$refs.form.validate((valid, obj) => {
  1316. let is = false;
  1317. this.form.datasource.forEach((item) => {
  1318. if (Number(item.totalCount) > item.orderTotalCount) {
  1319. is = true;
  1320. }
  1321. });
  1322. if (is) {
  1323. this.$message.warning('发货数量大于订单总数量');
  1324. if (this.isTotalCount == 1) {
  1325. callback(false);
  1326. }
  1327. }
  1328. if (obj) {
  1329. let messages = Object.keys(obj).map((key) => obj[key][0]);
  1330. if (messages.length > 0) {
  1331. this.$message.warning(messages[0].message);
  1332. }
  1333. }
  1334. callback(valid);
  1335. });
  1336. }
  1337. }
  1338. };
  1339. </script>
  1340. <style lang="scss" scoped>
  1341. .headbox {
  1342. display: flex;
  1343. justify-content: flex-start;
  1344. align-items: center;
  1345. .amount {
  1346. font-size: 14px;
  1347. font-weight: bold;
  1348. padding-right: 30px;
  1349. }
  1350. }
  1351. .time-form .el-form-item {
  1352. margin-bottom: 0 !important;
  1353. }
  1354. ::v-deep .period {
  1355. display: flex;
  1356. .borderleftnone {
  1357. .el-input--medium .el-input__inner {
  1358. border-top-right-radius: 0;
  1359. border-bottom-right-radius: 0;
  1360. }
  1361. }
  1362. .borderrightnone {
  1363. .el-input--medium .el-input__inner {
  1364. border-top-left-radius: 0;
  1365. border-bottom-left-radius: 0;
  1366. }
  1367. }
  1368. }
  1369. ::v-deep .time-form tbody > tr:hover > td {
  1370. background-color: transparent !important;
  1371. }
  1372. ::v-deep .time-form .el-table tr {
  1373. background-color: #ffffff;
  1374. }
  1375. .pricebox {
  1376. display: flex;
  1377. justify-content: flex-start;
  1378. align-items: center;
  1379. font-weight: bold;
  1380. }
  1381. </style>