inventoryTable.vue 47 KB

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