inventoryTable.vue 50 KB

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