inventoryTable copy.vue 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170
  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"></el-input> -->
  79. <el-select
  80. v-model="scope.row.batchStockId"
  81. clearable
  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"></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, true)"
  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. <!-- <template v-if="scope.row.batchNo && $hasPermission('eom:saleordersendrecord:pending' ) && needPending == 1">
  373. <el-popconfirm
  374. v-if="scope.row.isSuspend === 1"
  375. class="ele-action"
  376. title="确定要取消挂起吗?"
  377. @confirm="pending(scope.row, 0)"
  378. >
  379. <template v-slot:reference>
  380. <el-link
  381. type="primary"
  382. :underline="false"
  383. >
  384. 取消挂起
  385. </el-link>
  386. </template>
  387. </el-popconfirm>
  388. <el-link v-else type="primary" :underline="false" @click="pendingReplaceTable(scope.row, scope.$index)">
  389. 挂起
  390. </el-link>
  391. </template> -->
  392. </template>
  393. </ele-pro-table>
  394. <productListNew
  395. ref="productListRef"
  396. @changeParent="changeParent"
  397. ></productListNew>
  398. <!--入库详情-->
  399. <innertboundDetailsDialog
  400. v-if="innerboundDetailsDialogFlag"
  401. ref="innerboundDetailsDialogRef"
  402. :innerboundDetailsDialogFlag.sync="innerboundDetailsDialogFlag"
  403. @saveDate="saveInnerDate"
  404. ></innertboundDetailsDialog>
  405. <!-- 库存台账 -->
  406. <stock-ledger-dialog
  407. v-if="stockLedgerDialogFlag"
  408. :stock-ledger-dialog-flag.sync="stockLedgerDialogFlag"
  409. ref="stockLedgerDialogRef"
  410. @getStockLedger="getStockLedger"
  411. ></stock-ledger-dialog>
  412. <selectStockLedgerDialog
  413. ref="selectStockLedgerDialogRef"
  414. @changeParent="replaceTable"
  415. ></selectStockLedgerDialog>
  416. <selectStockLedgerDialogPending
  417. ref="selectStockLedgerDialogPendingRef"
  418. @changeParent="pendingReplaceTableConfirm"
  419. ></selectStockLedgerDialogPending>
  420. <BIZproductList
  421. ref="BIZproductListRef"
  422. classType="1"
  423. :isGetInventoryTotal="true"
  424. @changeParent="changeParentBiz"
  425. :typeIds="typeIds"
  426. :isFirstRefreshTable="true"
  427. ></BIZproductList>
  428. </el-form>
  429. </template>
  430. <script>
  431. import { numberReg } from 'ele-admin';
  432. import dictMixins from '@/mixins/dictMixins';
  433. import productListNew from './product-listNew.vue';
  434. import {
  435. getWarehouseOutStock,
  436. getIdWarehouseList
  437. } from '@/api/saleManage/saleorder';
  438. import { copyObj } from '@/utils/util';
  439. import { getFile } from '@/api/system/file';
  440. import innertboundDetailsDialog from '@/BIZComponents/innerboundDetailsDialog.vue';
  441. import stockLedgerDialog from './stockLedger/stockLedgerDialog.vue';
  442. import getDynamicsColumns from '@/mixins/getDynamicsColumns';
  443. // import fileMain from '@/components/addDoc/index.vue';
  444. import selectStockLedgerDialog from '@/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue'; //库存台账
  445. import BIZproductList from '@/BIZComponents/product-list.vue';
  446. import { lbjtList } from '@/enum/dict.js';
  447. import tabMixins from '@/mixins/tableColumnsMixin';
  448. import { levelList } from '@/enum/dict.js';
  449. import { changeCount } from '@/BIZComponents/setProduct.js';
  450. import { parameterGetByCode } from '@/api/main/index.js';
  451. import { getSummaries } from '@/utils/util.js';
  452. import { getBatchList } from '@/api/wms';
  453. import selectStockLedgerDialogPending from './selectStockLedger/selectStockLedgerDialog.vue';
  454. export default {
  455. mixins: [dictMixins, getDynamicsColumns, tabMixins],
  456. props: {
  457. orderId: String,
  458. orderIds: String,
  459. needProduce: [String, Number],
  460. entrustedCode: String,
  461. pricingWay: [String, Number],
  462. isShowAdd: {
  463. type: Boolean,
  464. default: true
  465. },
  466. typeIds: {
  467. type: Array,
  468. default: () => []
  469. },
  470. oldProductList: {
  471. type: Array,
  472. default: () => []
  473. },
  474. sourceType: {
  475. type: [String, Number],
  476. default: ''
  477. },
  478. isTotalCount: {
  479. default: 0
  480. }
  481. },
  482. components: {
  483. // fileMain,
  484. innertboundDetailsDialog,
  485. productListNew,
  486. stockLedgerDialog,
  487. selectStockLedgerDialog,
  488. BIZproductList,
  489. selectStockLedgerDialogPending
  490. },
  491. data() {
  492. const defaultForm = {
  493. key: null,
  494. endTime: '',
  495. isFirst: 0,
  496. name: '',
  497. startTime: '',
  498. workHour: '',
  499. technicalDrawings: []
  500. // warehouseCode:"",
  501. // warehouseId:'',
  502. // warehouseName:'',
  503. };
  504. return {
  505. cacheKeyUrl: 'eos-saleManage-invoice-inventoryTable',
  506. current: {},
  507. childrenColumns: [
  508. {
  509. width: 45,
  510. type: 'selection',
  511. columnKey: 'selection',
  512. align: 'center'
  513. },
  514. {
  515. width: 45,
  516. type: 'index',
  517. columnKey: 'index',
  518. align: 'center',
  519. fixed: 'left'
  520. },
  521. {
  522. minWidth: 100,
  523. prop: 'code',
  524. label: '编码',
  525. align: 'center'
  526. },
  527. {
  528. minWidth: 140,
  529. prop: 'barcodes',
  530. label: '发货条码',
  531. align: 'center'
  532. },
  533. {
  534. minWidth: 100,
  535. prop: 'engrave',
  536. label: '刻码',
  537. align: 'center'
  538. }
  539. ],
  540. selection: [],
  541. discountTotalPrice: 0.0,
  542. allPrice: 0.0,
  543. curIndex: null,
  544. innerboundDetailsDialogFlag: false,
  545. stockLedgerDialogFlag: false,
  546. numberReg,
  547. defaultForm,
  548. warehouseList: [],
  549. dynamicsColumns: [],
  550. isWarehouseId: 0,
  551. blockCountColumn: {},
  552. form: {
  553. datasource: []
  554. },
  555. rules: {},
  556. columnsVersion: 1,
  557. needPending: 0
  558. };
  559. },
  560. created() {
  561. this.requestDict('产地');
  562. this.requestDict('生产类型');
  563. // 发起时物品清单是否需要挂起 //0否 1是
  564. parameterGetByCode({
  565. code: 'eom_saleOreder_invoice_pending'
  566. }).then((res) => {
  567. this.needPending = res.value;
  568. });
  569. parameterGetByCode({
  570. code: 'eom_saleManage_invoice_warehouseId'
  571. }).then((res) => {
  572. if (res.value) {
  573. this.isWarehouseId = res.value;
  574. }
  575. });
  576. },
  577. computed: {
  578. canHandl() {
  579. return this.form.datasource.length;
  580. },
  581. clientEnvironmentId() {
  582. return this.$store.state.user.info.clientEnvironmentId;
  583. },
  584. columns() {
  585. let columnsVersion = this.columnsVersion;
  586. return [
  587. {
  588. width: 60,
  589. type: 'index',
  590. columnKey: 'index',
  591. align: 'center',
  592. fixed: 'left'
  593. },
  594. {
  595. minWidth: 150,
  596. prop: 'orderNo',
  597. label: '订单编码',
  598. align: 'center',
  599. fixed: 'left'
  600. },
  601. {
  602. width: 200,
  603. prop: 'productName',
  604. label: '名称',
  605. slot: 'productName',
  606. align: 'center'
  607. },
  608. {
  609. width: 120,
  610. prop: 'productCode',
  611. label: '编码',
  612. slot: 'productCode',
  613. align: 'center'
  614. },
  615. {
  616. width: 200,
  617. prop: 'productCategoryName',
  618. label: '类型',
  619. slot: 'productCategoryName',
  620. align: 'center'
  621. },
  622. {
  623. width: 160,
  624. prop: 'batchStockId',
  625. label: '批次号',
  626. slot: 'batchStockId',
  627. align: 'center'
  628. },
  629. {
  630. width: 160,
  631. prop: 'productBrand',
  632. label: '牌号',
  633. slot: 'productBrand',
  634. align: 'center'
  635. },
  636. {
  637. width: 120,
  638. prop: 'modelType',
  639. label: '型号',
  640. slot: 'modelType',
  641. align: 'center'
  642. },
  643. {
  644. width: 120,
  645. prop: 'specification',
  646. label: '规格',
  647. slot: 'specification',
  648. align: 'center'
  649. },
  650. {
  651. width: 160,
  652. prop: 'modelKey',
  653. label: '机型',
  654. slot: 'modelKey',
  655. align: 'center'
  656. },
  657. {
  658. width: 160,
  659. prop: 'colorKey',
  660. label: '颜色',
  661. slot: 'colorKey',
  662. align: 'center'
  663. },
  664. {
  665. minWidth: 160,
  666. prop: 'productionCodes',
  667. label: '生产编号',
  668. align: 'center',
  669. slot: 'productionCodes'
  670. },
  671. {
  672. minWidth: 280,
  673. prop: 'productionRequirements',
  674. label: '生产要求',
  675. align: 'center'
  676. },
  677. {
  678. minWidth: 120,
  679. prop: 'goodsLevel',
  680. label: '物品级别',
  681. formatter: (_row, _column, cellValue) => {
  682. return levelList.find((item) => item.value == _row.goodsLevel)
  683. ?.label;
  684. },
  685. align: 'center'
  686. },
  687. ...this.dynamicsColumns,
  688. {
  689. width: 120,
  690. prop: 'customerMark',
  691. label: '客户代号',
  692. slot: 'customerMark',
  693. align: 'center'
  694. },
  695. {
  696. width: 200,
  697. prop: 'warehouseId',
  698. label: '仓库名称',
  699. slot: 'warehouseId',
  700. headerSlot: 'headerWarehouseId',
  701. align: 'center'
  702. },
  703. {
  704. width: 100,
  705. prop: 'warehouseNum',
  706. label: '库存',
  707. align: 'center',
  708. slot: 'warehouseNum'
  709. },
  710. // {
  711. // width: 100,
  712. // prop: 'stockLedger',
  713. // label: '发货明细',
  714. // slot: 'stockLedger',
  715. // align: 'center'
  716. // },
  717. {
  718. width: 250,
  719. prop: 'saleCount',
  720. label: '发货数量',
  721. slot: 'saleCount',
  722. headerSlot: 'headerTotalCount',
  723. align: 'center'
  724. },
  725. {
  726. width: 100,
  727. prop: 'notSendTotalCount',
  728. label: '未发数量',
  729. align: 'center',
  730. formatter: (row, column) => {
  731. if (row.notSendTotalCount) {
  732. return row.notSendTotalCount + ' ' + row.measuringUnit;
  733. }
  734. }
  735. },
  736. // {
  737. // width: 150,
  738. // prop: 'saleUnit',
  739. // label: '单位',
  740. // slot: 'saleUnit',
  741. // align: 'center'
  742. // },
  743. {
  744. width: 120,
  745. prop: 'packingSpecification',
  746. align: 'center',
  747. label: '包装规格',
  748. showOverflowTooltip: true
  749. },
  750. {
  751. width: 120,
  752. prop: 'totalCount',
  753. label: '计量数量',
  754. formatter: (row, column) => {
  755. if (row.totalCount) {
  756. return row.totalCount + ' ' + row.measuringUnit;
  757. }
  758. },
  759. align: 'center'
  760. },
  761. {
  762. width: 120,
  763. prop: 'orderTotalCount',
  764. label: '订单数量',
  765. formatter: (row, column) => {
  766. if (row.orderTotalCount) {
  767. return row.orderTotalCount + ' ' + row.measuringUnit;
  768. }
  769. },
  770. align: 'center'
  771. },
  772. // {
  773. // width: 80,
  774. // prop: 'measuringUnit',
  775. // label: '计量单位',
  776. // slot: 'measuringUnit',
  777. // align: 'center'
  778. // },
  779. this.clientEnvironmentId == 4
  780. ? {
  781. width: 150,
  782. prop: 'blockCount',
  783. label: '发货块数',
  784. slot: 'blockCount',
  785. align: 'center'
  786. }
  787. : { width: 1 },
  788. {
  789. width: 200,
  790. prop: 'singleWeight',
  791. slot: 'singleWeight',
  792. label: '单重',
  793. align: 'center'
  794. },
  795. {
  796. width: 250,
  797. prop: 'receiveTotalWeight',
  798. label: '收货总重',
  799. slot: 'receiveTotalWeight',
  800. align: 'center',
  801. headerSlot: 'headerReceiveTotalWeight'
  802. },
  803. {
  804. width: 220,
  805. prop: 'sendTotalWeight',
  806. label: '发货总重',
  807. slot: 'sendTotalWeight',
  808. align: 'center'
  809. },
  810. {
  811. width: 220,
  812. prop: 'increaseTotalWeight',
  813. label: '增重重量',
  814. slot: 'increaseTotalWeight',
  815. align: 'center'
  816. },
  817. {
  818. width: 180,
  819. prop: 'singlePrice',
  820. label: '单价',
  821. slot: 'singlePrice',
  822. align: 'center'
  823. },
  824. {
  825. width: 160,
  826. prop: 'taxRate',
  827. label: '税率',
  828. formatter: (_row, _column, cellValue) => {
  829. return _row.taxRate ? _row.taxRate + '%' : '';
  830. },
  831. align: 'center'
  832. },
  833. {
  834. width: 180,
  835. prop: 'notaxSinglePrice',
  836. label: '不含税单价',
  837. align: 'center'
  838. },
  839. {
  840. width: 160,
  841. prop: 'discountSinglePrice',
  842. label: '折后单价',
  843. slot: 'discountSinglePrice',
  844. align: 'center'
  845. },
  846. {
  847. width: 120,
  848. prop: 'totalPrice',
  849. label: '合计',
  850. slot: 'totalPrice',
  851. align: 'center'
  852. },
  853. {
  854. width: 160,
  855. prop: 'notaxTotalPrice',
  856. label: '含税合计',
  857. align: 'center'
  858. },
  859. {
  860. width: 120,
  861. prop: 'discountTotalPrice',
  862. label: '折后合计',
  863. slot: 'discountTotalPrice',
  864. align: 'center'
  865. },
  866. {
  867. width: 120,
  868. prop: 'imgCode',
  869. align: 'center',
  870. label: '图号/件号',
  871. showOverflowTooltip: true
  872. },
  873. {
  874. width: 120,
  875. prop: 'produceType',
  876. align: 'center',
  877. label: '属性类型',
  878. formatter: (row, column) => {
  879. if (row.produceType) {
  880. return row.produceType
  881. .map((item) => {
  882. return lbjtList[item];
  883. })
  884. .toString();
  885. }
  886. },
  887. showOverflowTooltip: true
  888. },
  889. {
  890. width: 200,
  891. prop: 'guaranteePeriod',
  892. label: '有效期',
  893. slot: 'guaranteePeriod',
  894. formatter: (_row, _column, cellValue) => {
  895. let val = '';
  896. if (_row.guaranteePeriod) {
  897. val += _row.guaranteePeriod;
  898. }
  899. if (_row.guaranteePeriodUnitName) {
  900. val += _row.guaranteePeriodUnitName;
  901. }
  902. return val;
  903. },
  904. align: 'center'
  905. },
  906. {
  907. width: 200,
  908. prop: 'guaranteePeriodDeadline',
  909. label: '有效期截止日期',
  910. slot: 'guaranteePeriodDeadline',
  911. align: 'center'
  912. },
  913. {
  914. prop: 'provenance',
  915. label: '产地',
  916. slot: 'provenance',
  917. align: 'center',
  918. // show:this.contractBookType==2,
  919. minWidth: 200,
  920. showOverflowTooltip: true,
  921. formatter: (row, column) => {
  922. return row.provenance && row.provenance.length
  923. ? row.provenance
  924. .map((item) => this.getDictValue('产地', item))
  925. .join(',')
  926. : '';
  927. }
  928. },
  929. {
  930. width: 130,
  931. prop: 'technicalAnswerName',
  932. label: '技术答疑人',
  933. slot: 'technicalAnswerName',
  934. align: 'center'
  935. },
  936. {
  937. width: 220,
  938. prop: 'technicalParams',
  939. label: '技术参数',
  940. slot: 'technicalParams',
  941. align: 'center'
  942. },
  943. {
  944. width: 240,
  945. prop: 'technicalDrawings',
  946. label: '技术图纸',
  947. slot: 'technicalDrawings',
  948. align: 'center'
  949. },
  950. {
  951. width: 220,
  952. prop: 'remark',
  953. label: '备注',
  954. slot: 'remark',
  955. align: 'center'
  956. },
  957. {
  958. columnKey: 'action',
  959. label: '操作',
  960. width: 200,
  961. align: 'center',
  962. resizable: false,
  963. slot: 'action',
  964. fixed: 'right',
  965. showOverflowTooltip: true
  966. }
  967. ];
  968. }
  969. },
  970. mounted() {
  971. // this.clientEnvironmentId =
  972. },
  973. methods: {
  974. // 挂起/取消挂起功能
  975. async pending(row) {
  976. console.log('pending~~~', row)
  977. // 取消挂起不需要二次确认
  978. this.$set(row, 'isSuspend', 0);
  979. this.$forceUpdate();
  980. this.current['offsetDetail'] = [];
  981. this.current['isSuspend'] = 0;
  982. this.$set(this.current, 'warehouseList', await getIdWarehouseList({
  983. categoryId: this.current.id
  984. }))
  985. this.$set(this.current, 'warehouseId', '')
  986. },
  987. // 通过挂起状态设置行样式
  988. tableRowClassName({row}) {
  989. // console.log('tableRowClassName', row)
  990. if (row.isSuspend == 1) {
  991. return 'warning-row';
  992. }
  993. return '';
  994. },
  995. // 挂起选择库存
  996. pendingReplaceTable(row, index) {
  997. // console.log('handleWarehouseClick', row, index)
  998. this.current = row;
  999. this.$refs.selectStockLedgerDialogPendingRef.open(row, index)
  1000. },
  1001. pendingReplaceTableConfirm(list) {
  1002. console.log('confirm', list)
  1003. list.forEach((item) => {
  1004. // item.warehouseList = item.warehouseList.map( i => {
  1005. // return {
  1006. // warehouseName: i.warehouse_name,
  1007. // warehouseId: i.warehouse_id,
  1008. // }
  1009. // })
  1010. item.warehouseList = [{
  1011. warehouseName: item.warehouseName,
  1012. warehouseId: item.warehouseId,
  1013. }]
  1014. });
  1015. // if(list[0].warehouseList.length == 1) {
  1016. // this.$set(this.current, 'warehouseId', list[0].warehouseId)
  1017. // }
  1018. this.$set(this.current, 'warehouseList', list[0].warehouseList)
  1019. this.$set(this.current, 'warehouseId', list[0].warehouseId)
  1020. this.$set(this.current, 'warehouseNum', list[0].measureQuantity)
  1021. this.current['offsetDetail'] = list
  1022. this.$set(this.current, 'isSuspend', 1)
  1023. console.log('current', this.current)
  1024. // this.$emit('pendingReplaceTableConfirm', list);
  1025. // this.$emit('replaceTableChange', list);
  1026. // console.log('pendingReplaceTableConfirm', list)
  1027. },
  1028. getSummaries(param) {
  1029. if (this.clientEnvironmentId != 4) {
  1030. return;
  1031. }
  1032. return getSummaries(
  1033. param,
  1034. ['saleCount', 'blockCount', 'totalCount'],
  1035. ' '
  1036. );
  1037. },
  1038. downloadFile(file) {
  1039. getFile({ objectName: file.storePath }, file.name);
  1040. },
  1041. //发货明细选择
  1042. stockLedgerSelect(row, index) {
  1043. this.curIndex = index;
  1044. this.stockLedgerDialogFlag = true;
  1045. this.$nextTick(() => {
  1046. this.$refs.stockLedgerDialogRef.init(row.sendProductDetail, row);
  1047. });
  1048. },
  1049. // changeCount1(row, index) {
  1050. // this.tableHandleKeyUp(row, index, 'sum');
  1051. // this.changeCount(row, index);
  1052. // },
  1053. packingChange(item, index) {
  1054. this.$set(this.form.datasource[index], 'saleUnit', item.conversionUnit);
  1055. },
  1056. //改变数量
  1057. // changeCount() {
  1058. // this.form.datasource.forEach((item, index) => {
  1059. // if (item.pricingWay == 1) {
  1060. // this.$set(
  1061. // this.form.datasource[index],
  1062. // 'discountTotalPrice',
  1063. // item.discountSinglePrice * item.totalCount
  1064. // );
  1065. // this.$set(
  1066. // this.form.datasource[index],
  1067. // 'totalPrice',
  1068. // item.singlePrice * item.totalCount
  1069. // );
  1070. // }
  1071. // if (item.pricingWay == 2) {
  1072. // this.$set(
  1073. // this.form.datasource[index],
  1074. // 'discountTotalPrice',
  1075. // item.discountSinglePrice *
  1076. // item.totalCount *
  1077. // (item.singleWeight || 0)
  1078. // );
  1079. // this.$set(
  1080. // this.form.datasource[index],
  1081. // 'totalPrice',
  1082. // item.singlePrice * item.totalCount * (item.singleWeight || 0)
  1083. // );
  1084. // }
  1085. // });
  1086. // },
  1087. //获取
  1088. getStockLedger(sendProductDetail) {
  1089. if (!this.form.datasource[this.curIndex].sendProductDetail)
  1090. this.form.datasource[this.curIndex].sendProductDetail = [];
  1091. let row = this.form.datasource[this.curIndex];
  1092. row.sendProductDetail.push(...sendProductDetail);
  1093. this.form.datasource[this.curIndex] = row;
  1094. this.$refs['childrenTable' + this.curIndex].reload();
  1095. this.$refs.table.reload();
  1096. },
  1097. //删除发货明细
  1098. stockLedgerRemove(PIndex) {
  1099. let row = this.form.datasource[PIndex];
  1100. this.selection.forEach((item) => {
  1101. let index = row.sendProductDetail.findIndex((i) => i.id == item.id);
  1102. row.sendProductDetail.splice(index, 1);
  1103. });
  1104. this.form.datasource[PIndex] = row;
  1105. this.$refs['childrenTable' + PIndex].reload();
  1106. this.$refs.table.reload();
  1107. this.selection = [];
  1108. },
  1109. async warehouseChange(index, row, isReset = false) {
  1110. console.log('warehouseChange', index, row.isSuspend, isReset);
  1111. const data = row.warehouseList.find(
  1112. (item) => item.warehouseId == row.warehouseId
  1113. );
  1114. this.$set(
  1115. this.form.datasource[index],
  1116. 'warehouseName',
  1117. data.warehouseName
  1118. );
  1119. this.$set(
  1120. this.form.datasource[index],
  1121. 'warehouseCode',
  1122. data.warehouseCode
  1123. );
  1124. const warehouseOutStock = await getWarehouseOutStock({
  1125. warehouseId: data.warehouseId,
  1126. code: row.productCode
  1127. });
  1128. this.$set(
  1129. this.form.datasource[index],
  1130. 'warehouseNum',
  1131. warehouseOutStock || 0
  1132. );
  1133. const tempBatchNoList = await getBatchList({
  1134. warehouseId: data.warehouseId,
  1135. categoryCode: row.productCode
  1136. });
  1137. this.$set(
  1138. this.form.datasource[index],
  1139. 'batchNoList',
  1140. tempBatchNoList?.list || []
  1141. );
  1142. if(isReset && row.isSuspend != 1) {
  1143. this.$set(this.form.datasource[index], 'batchStockId', '');
  1144. this.$set(this.form.datasource[index], 'batchNo', '');
  1145. }
  1146. },
  1147. //批次号选择
  1148. async batchNoChange(index, row) {
  1149. if(!row.batchStockId) {
  1150. this.$set(this.form.datasource[index], 'batchNo', '');
  1151. // this.$set(this.form.datasource[index], 'warehouseNum', '');
  1152. const tempWarehouse = await getIdWarehouseList({
  1153. categoryId: this.form.datasource[index].productId,
  1154. })
  1155. // 有仓库列表
  1156. if (tempWarehouse?.length) {
  1157. console.log('666~~~~!!', index, tempWarehouse);
  1158. this.$set(
  1159. this.form.datasource[index],
  1160. 'warehouseList',
  1161. tempWarehouse
  1162. );
  1163. }
  1164. this.$set(this.form.datasource[index], 'warehouseNum', row.warehouseId ? await getWarehouseOutStock({
  1165. warehouseId: row.warehouseId,
  1166. code: row.productCode
  1167. }) : '');
  1168. return;
  1169. }
  1170. const data = row.batchNoList.find(
  1171. (item) => item.id == row.batchStockId
  1172. );
  1173. this.$set(this.form.datasource[index], 'batchNo', data.batchNo);
  1174. this.$set(
  1175. this.form.datasource[index],
  1176. 'warehouseNum',
  1177. data.measureQuantity || 0
  1178. );
  1179. },
  1180. //改变数量
  1181. changeCount(row, index, isBlockCount = true) {
  1182. this.$set(
  1183. this.form,
  1184. 'datasource[' + index + ']',
  1185. changeCount(row, {
  1186. countKey: 'saleCount',
  1187. unitKey: 'saleUnit',
  1188. unitIdKey: 'saleUnitId'
  1189. })
  1190. );
  1191. this.$set(
  1192. this.form.datasource[index],
  1193. 'sendTotalWeight',
  1194. this.form.datasource[index].totalWeight
  1195. );
  1196. this.changeSendTotalWeight(row, index);
  1197. this.getNotaxSinglePrice();
  1198. this.$forceUpdate();
  1199. if (this.clientEnvironmentId == 4 && !isBlockCount) {
  1200. this.tableHandleKeyUp(row, index, 'sum');
  1201. }
  1202. },
  1203. //修改发货总重
  1204. changeSendTotalWeight(row, index) {
  1205. this.curIndex = index;
  1206. this.setIcreaseTotalWeight(row);
  1207. },
  1208. keyChange(index, row, key) {
  1209. this.$set(
  1210. this.form.datasource[index],
  1211. 'extField.' + key,
  1212. row.extField[key]
  1213. );
  1214. this.$forceUpdate();
  1215. },
  1216. //设置增重总重
  1217. setIcreaseTotalWeight(row) {
  1218. let receiveTotalWeight = Number(
  1219. this.form.datasource[this.curIndex]?.receiveTotalWeight
  1220. );
  1221. let sendTotalWeight = Number(
  1222. this.form.datasource[this.curIndex]?.sendTotalWeight
  1223. );
  1224. if (sendTotalWeight && receiveTotalWeight) {
  1225. this.$set(
  1226. this.form.datasource[this.curIndex],
  1227. 'increaseTotalWeight',
  1228. (sendTotalWeight - receiveTotalWeight).toFixed(2)
  1229. );
  1230. }
  1231. this.$refs.table.reload();
  1232. this.$forceUpdate();
  1233. },
  1234. //计算不含税单价
  1235. getNotaxSinglePrice() {
  1236. this.form.datasource.forEach((item, index) => {
  1237. if (item.singlePrice && item.taxRate) {
  1238. this.$set(
  1239. this.form.datasource[index],
  1240. 'notaxSinglePrice',
  1241. parseFloat(
  1242. (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
  1243. )
  1244. );
  1245. } else {
  1246. this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
  1247. }
  1248. });
  1249. },
  1250. //入库单详情
  1251. handleInnerBound(e, rows, index) {
  1252. this.curIndex = index;
  1253. this.innerboundDetailsDialogFlag = true;
  1254. this.$nextTick(() => {
  1255. let row = {
  1256. code: this.entrustedCode
  1257. };
  1258. this.$refs.innerboundDetailsDialogRef.init(row);
  1259. });
  1260. },
  1261. //选择入库单信息
  1262. saveInnerDate(data = []) {
  1263. let totalWeight = data.reduce((num, row) => {
  1264. num += Number(row.weight);
  1265. return num;
  1266. }, 0);
  1267. this.$set(
  1268. this.form.datasource[this.curIndex],
  1269. 'receiveTotalWeight',
  1270. totalWeight
  1271. );
  1272. console.log(totalWeight, 'totalWeight');
  1273. this.setIcreaseTotalWeight(this.form.datasource[this.curIndex]);
  1274. },
  1275. // getWeightPrice() {
  1276. // let increaseTotalWeight =
  1277. // this.form.datasource[this.curIndex].increaseTotalWeight;
  1278. // let singlePrice = this.form.datasource[this.curIndex].singlePrice;
  1279. // let discountSinglePrice =
  1280. // this.form.datasource[this.curIndex].discountSinglePrice;
  1281. // this.$set(
  1282. // this.form.datasource[this.curIndex],
  1283. // 'totalPrice',
  1284. // (Number(increaseTotalWeight) * Number(singlePrice)).toFixed(2)
  1285. // );
  1286. // this.$set(
  1287. // this.form.datasource[this.curIndex],
  1288. // 'discountTotalPrice',
  1289. // (Number(discountSinglePrice) * Number(increaseTotalWeight)).toFixed(2)
  1290. // );
  1291. // },
  1292. // 表格:模数、数量(方)、块数输入框 输入事件
  1293. tableHandleKeyUp(row, index, name) {
  1294. if (row.specification) {
  1295. let modelArr = row.specification.split('*');
  1296. let modelLong = modelArr[0]; // model规格长度
  1297. let modeWide = modelArr[1]; // model规格宽度
  1298. let modeHight = modelArr[2].substr(0, modelArr[2].indexOf('cm')); // model规格高度
  1299. modeHight = Number(modeHight);
  1300. if (name === 'sum') {
  1301. row.blockCount = Math.floor(
  1302. row.totalCount / ((modelLong * modeWide * modeHight) / 1000000)
  1303. );
  1304. } else if (name === 'blockCount') {
  1305. row.totalCount =
  1306. (Number(row.blockCount) * modelLong * modeWide * modeHight) /
  1307. 1000000;
  1308. row.saleCount = row.totalCount;
  1309. this.changeCount(row, index, true);
  1310. }
  1311. }
  1312. },
  1313. //选择产品回调
  1314. async changeParent(obj) {
  1315. console.log(obj, 'obj');
  1316. obj.forEach((item) => {
  1317. item.orderTotalCount = item.totalCount;
  1318. item.id = '';
  1319. });
  1320. this.putTableValue(copyObj(obj));
  1321. },
  1322. //选择产品回调
  1323. changeParentBiz(obj = [], idx) {
  1324. obj.forEach(async (item, index) => {
  1325. let i = idx == -1 ? index : idx;
  1326. let row = JSON.parse(JSON.stringify(this.defaultForm));
  1327. row.key = this.form.datasource.length + 1;
  1328. row['tempId'] = this.form.datasource.length + 1;
  1329. let parasm = idx == -1 ? row : this.form.datasource[i];
  1330. this.$set(parasm, 'productId', item.id);
  1331. this.$set(parasm, 'categoryName', item.name);
  1332. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  1333. this.$set(parasm, 'productBrand', item.brandNum);
  1334. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  1335. this.$set(parasm, 'productCode', item.code);
  1336. this.$set(parasm, 'productName', item.name);
  1337. this.$set(parasm, 'modelType', item.modelType);
  1338. this.$set(parasm, 'availableCountBase', item.availableCountBase);
  1339. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  1340. this.$set(parasm, 'specification', item.specification);
  1341. this.$set(parasm, 'weightUnit', item.weightUnit);
  1342. this.$set(parasm, 'imgCode', item.imgCode);
  1343. this.$set(parasm, 'produceType', item.componentAttribute);
  1344. this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
  1345. this.$set(parasm, 'extField', item.extField || {});
  1346. this.$set(parasm, 'singleWeight', item.netWeight);
  1347. this.$set(parasm, 'pricingWay', item.pricingWay || 1);
  1348. this.$set(parasm, 'singlePrice', 0);
  1349. this.$set(parasm, 'discountSinglePrice', 0);
  1350. this.$set(parasm, 'goodsLevel', item.goodsLevel);
  1351. if (item.modelKey) {
  1352. this.$set(parasm, 'modelKey', item.modelKey.split(','));
  1353. }
  1354. if (item.colorKey) {
  1355. this.$set(parasm, 'colorKey', item.colorKey.split(','));
  1356. }
  1357. this.$set(parasm, 'receiveTotalWeight', 0);
  1358. this.$set(parasm, 'sendTotalWeight', 0);
  1359. this.$set(parasm, 'increaseTotalWeight', 0);
  1360. this.$set(
  1361. parasm,
  1362. 'packageDispositionList',
  1363. item.packageDispositionList
  1364. );
  1365. if (item.packageDispositionList?.length) {
  1366. this.$set(parasm, 'saleUnitId', item.packageDispositionList[0].id);
  1367. this.$set(
  1368. parasm,
  1369. 'saleUnit',
  1370. item.packageDispositionList[0].conversionUnit
  1371. );
  1372. }
  1373. this.$set(
  1374. parasm,
  1375. 'warehouseList',
  1376. await getIdWarehouseList({
  1377. categoryId: item.id
  1378. })
  1379. );
  1380. this.$set(
  1381. parasm,
  1382. 'batchNoList',
  1383. await getBatchList({
  1384. categoryCode: item.productCode,
  1385. warehouseId: item.warehouseId,
  1386. size: -1
  1387. })
  1388. );
  1389. this.$set(
  1390. parasm,
  1391. 'packingSpecification',
  1392. item.extField?.packingSpecification
  1393. );
  1394. this.$set(
  1395. parasm,
  1396. 'supplierMark',
  1397. this.form.datasource[0]?.supplierMark
  1398. );
  1399. if (item.purchaseOrigins?.length > 0) {
  1400. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  1401. }
  1402. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  1403. if (idx == -1) {
  1404. this.form.datasource.push(row);
  1405. }
  1406. });
  1407. },
  1408. replaceTable(list) {
  1409. list.forEach((item) => {
  1410. item['relationId'] = this.current.tempId;
  1411. });
  1412. this.$emit('replaceTableChange', list);
  1413. },
  1414. // validateTotalCount(row) {
  1415. // return (rule, value, callback) => {
  1416. // if (isNaN(value) || Number(value) <= 0) {
  1417. // this.$message.error('请输入大于0的数');
  1418. // callback(false);
  1419. // } else else {
  1420. // callback();
  1421. // }
  1422. // };
  1423. // },
  1424. // 返回列表数据
  1425. getTableValue() {
  1426. let comitDatasource = this.form.datasource;
  1427. if (comitDatasource.length === 0) return [];
  1428. comitDatasource.forEach(async (v) => {
  1429. if (v.modelKey) {
  1430. v.modelKey = v.modelKey.toString();
  1431. }
  1432. if (v.colorKey) {
  1433. v.colorKey = v.colorKey.toString();
  1434. }
  1435. v.totalCount = Number(v.totalCount);
  1436. v.technicalDrawings = Array.isArray(v.technicalDrawings)
  1437. ? v.technicalDrawings
  1438. : [];
  1439. v.customerReqFiles = Array.isArray(v.customerReqFiles)
  1440. ? v.customerReqFiles
  1441. : [];
  1442. v.industryArtFiles = v.industryArtFiles || [];
  1443. v.otherFiles = v.otherFiles || [];
  1444. });
  1445. return comitDatasource;
  1446. },
  1447. getPrice() {
  1448. return [this.allPrice];
  1449. },
  1450. //修改回显
  1451. putTableValue(data, isInit) {
  1452. if (isInit) {
  1453. this.form.datasource = [];
  1454. }
  1455. if (data) {
  1456. this.setValue(data);
  1457. }
  1458. },
  1459. setValue(data) {
  1460. console.log('setValue~~~~~~', data);
  1461. let indexS = [];
  1462. data.forEach((item, index) => {
  1463. if (item.modelKey) {
  1464. this.$set(data[index], 'modelKey', item.modelKey.split(','));
  1465. }
  1466. if (item.colorKey) {
  1467. this.$set(data[index], 'colorKey', item.colorKey.split(','));
  1468. }
  1469. item.receiveTotalWeight = item.receiveTotalWeight || 0;
  1470. if (item.weightUnit == item.measuringUnit) {
  1471. item.sendTotalWeight = item.sendTotalWeight || item.totalCount;
  1472. } else {
  1473. item.sendTotalWeight =
  1474. item.sendTotalWeight ||
  1475. Number(item.totalCount) * Number(item.singleWeight) ||
  1476. 0;
  1477. }
  1478. if (this.outsourceSendCode) {
  1479. item.increaseTotalWeight =
  1480. Number(item.receiveTotalWeight) - Number(item.sendTotalWeight);
  1481. item.increaseTotalWeight;
  1482. } else {
  1483. item.increaseTotalWeight =
  1484. item.increaseTotalWeight || item.receiveTotalWeight || 0;
  1485. }
  1486. item['sendTotalWeight'] = item.sendTotalWeigh;
  1487. item['increaseTotalWeight'] = item.increaseTotalWeight;
  1488. item['tempId'] = this.form.datasource.length;
  1489. indexS.push(this.form.datasource.length);
  1490. this.$set(
  1491. this.form.datasource,
  1492. this.form.datasource.length,
  1493. copyObj(item)
  1494. );
  1495. // this.form.datasource.push(item);
  1496. });
  1497. this.form.datasource.forEach(async (item, index) => {
  1498. if (indexS.includes(index)) {
  1499. if(!item.batchNo) {
  1500. console.log('111~~~~', index);
  1501. this.$set(
  1502. this.form.datasource[index],
  1503. 'warehouseList',
  1504. await getIdWarehouseList({
  1505. categoryId: item.productId
  1506. })
  1507. );
  1508. if (item.warehouseId) {
  1509. this.$set(
  1510. this.form.datasource[index],
  1511. 'warehouseNum',
  1512. item.stockNum ? item.stockNum : await getWarehouseOutStock({
  1513. warehouseId: item.warehouseId,
  1514. code: item.productCode
  1515. })
  1516. );
  1517. } else if (this.form.datasource[index]?.warehouseList?.length) {
  1518. this.$set(
  1519. this.form.datasource[index],
  1520. 'warehouseId',
  1521. this.form.datasource[index]?.warehouseList[0].warehouseId
  1522. );
  1523. await this.warehouseChange(index, this.form.datasource[index]);
  1524. }
  1525. const templist = await getBatchList({
  1526. categoryCode: item.productCode,
  1527. warehouseId: item.warehouseId,
  1528. size: -1
  1529. });
  1530. console.log('templist~~~~', index, templist.list);
  1531. // 批次号
  1532. this.$set(
  1533. this.form.datasource[index],
  1534. 'batchNoList',
  1535. templist?.list || []
  1536. );
  1537. // console.log(this.form.datasource[index]);
  1538. } else {
  1539. this.setBatchAndWarehouse(item, index);
  1540. }
  1541. }
  1542. });
  1543. },
  1544. async setBatchAndWarehouse(item, index) {
  1545. console.log('333~~~~', index);
  1546. // 通过产品编码查仓库
  1547. const tempWarehouse = await getIdWarehouseList({
  1548. categoryId: item.productId,
  1549. })
  1550. // 有仓库列表
  1551. if (tempWarehouse?.length) {
  1552. console.log('666~~~~', index, tempWarehouse);
  1553. this.$set(
  1554. this.form.datasource[index],
  1555. 'warehouseList',
  1556. tempWarehouse
  1557. );
  1558. if (item.warehouseId) {
  1559. this.$set(
  1560. this.form.datasource[index],
  1561. 'warehouseNum',
  1562. item.stockNum ? item.stockNum : await getWarehouseOutStock({
  1563. warehouseId: item.warehouseId,
  1564. code: item.productCode
  1565. })
  1566. );
  1567. } else {
  1568. if (this.form.datasource[index]?.warehouseList?.length) {
  1569. this.$set(
  1570. this.form.datasource[index],
  1571. 'warehouseId',
  1572. this.form.datasource[index]?.warehouseList[0].warehouseId
  1573. );
  1574. await this.warehouseChange(index, this.form.datasource[index]);
  1575. }
  1576. }
  1577. const templist1 = await getBatchList({
  1578. categoryCode: item.productCode,
  1579. warehouseId: item.warehouseId,
  1580. size: -1
  1581. });
  1582. let tempBatchNoList = templist1?.list || [];
  1583. console.log('888~~~~', index, item.batchNo);
  1584. const batchNoObj = tempBatchNoList.find(i => i.batchNo == item.batchNo);
  1585. if(batchNoObj) {
  1586. this.$set(
  1587. this.form.datasource[index],
  1588. 'batchStockId',
  1589. batchNoObj.id
  1590. );
  1591. this.$set(
  1592. this.form.datasource[index],
  1593. 'warehouseNum',
  1594. item.stockNum ? item.stockNum : batchNoObj.measureQuantity || 0
  1595. );
  1596. } else { //不存在
  1597. // 批次列表添加不存在的批次号对象
  1598. tempBatchNoList.push({
  1599. batchNo: item.batchNo,
  1600. id: 999,
  1601. measureQuantity: 0
  1602. })
  1603. // 设置为不存在的批次ID
  1604. this.$set(
  1605. this.form.datasource[index],
  1606. 'batchStockId',
  1607. 999
  1608. );
  1609. this.$set(
  1610. this.form.datasource[index],
  1611. 'warehouseNum',
  1612. item.stockNum ? item.stockNum : ''
  1613. );
  1614. }
  1615. // // 批次号
  1616. this.$set(
  1617. this.form.datasource[index],
  1618. 'batchNoList',
  1619. tempBatchNoList
  1620. );
  1621. } else {
  1622. if(item.batchNo) {
  1623. const tempBatchNoList = [{
  1624. batchNo: item.batchNo,
  1625. id: 999,
  1626. measureQuantity: 0
  1627. }]
  1628. this.$set(
  1629. this.form.datasource[index],
  1630. 'batchNoList',
  1631. tempBatchNoList
  1632. );
  1633. this.$set(
  1634. this.form.datasource[index],
  1635. 'batchStockId',
  1636. 999
  1637. );
  1638. this.$set(
  1639. this.form.datasource[index],
  1640. 'warehouseNum',
  1641. item.stockNum ? item.stockNum : ''
  1642. );
  1643. }
  1644. }
  1645. },
  1646. async setBatchAndWarehouse1(item, index) {
  1647. // 通过产品编号和批次号获取仓库列表
  1648. const warehouse = await getIdWarehouseList({
  1649. categoryId: item.productId,
  1650. // batchNo: item.batchNo
  1651. })
  1652. // 如果有仓库列表
  1653. if (warehouse?.length) {
  1654. console.log('222~~~~', index, item.batchNo);
  1655. // 设置仓库列表
  1656. this.$set(
  1657. this.form.datasource[index],
  1658. 'warehouseList',
  1659. warehouse
  1660. );
  1661. // 如果有仓库ID
  1662. if (item.warehouseId) {
  1663. // console.log('444~~~~');
  1664. // const templist = await getBatchList({
  1665. // categoryCode: item.productCode,
  1666. // warehouseId: item.warehouseId,
  1667. // size: -1
  1668. // });
  1669. // const batchNoList = templist?.list || [];
  1670. // // 批次号
  1671. // this.$set(
  1672. // this.form.datasource[index],
  1673. // 'batchNoList',
  1674. // batchNoList
  1675. // );
  1676. // const batchNo = batchNoList.find(i => i.batchNo === item.batchNo);
  1677. // if (batchNo) {
  1678. // this.$set(
  1679. // this.form.datasource[index],
  1680. // 'batchStockId',
  1681. // batchNo.id
  1682. // );
  1683. // this.$set(
  1684. // this.form.datasource[index],
  1685. // 'warehouseNum',
  1686. // data.measureQuantity || 0
  1687. // );
  1688. // }
  1689. }
  1690. // 没有仓库ID,设置第一个仓库ID
  1691. else {
  1692. if (this.form.datasource[index]?.warehouseList?.length){
  1693. console.log('555~~~~', index);
  1694. this.$set(
  1695. this.form.datasource[index],
  1696. 'warehouseId',
  1697. this.form.datasource[index]?.warehouseList[0].warehouseId
  1698. );
  1699. // await this.warehouseChange(index, this.form.datasource[index]);
  1700. }
  1701. }
  1702. // const wdata = warehouse.find(
  1703. // (i) => i.warehouseId == row.warehouseId
  1704. // );
  1705. // this.$set(
  1706. // this.form.datasource[index],
  1707. // 'warehouseName',
  1708. // wdata.warehouseName
  1709. // );
  1710. // this.$set(
  1711. // this.form.datasource[index],
  1712. // 'warehouseCode',
  1713. // wdata.warehouseCode
  1714. // );
  1715. // const warehouseOutStock = await getWarehouseOutStock({
  1716. // warehouseId: wdata.warehouseId,
  1717. // code: row.productCode
  1718. // });
  1719. // this.$set(
  1720. // this.form.datasource[index],
  1721. // 'warehouseNum',
  1722. // warehouseOutStock || 0
  1723. // );
  1724. console.log('444~~~~');
  1725. // 通过仓库ID获取批次号列表
  1726. const templist = await getBatchList({
  1727. categoryCode: item.productCode,
  1728. warehouseId: item.warehouseId,
  1729. size: -1
  1730. });
  1731. let batchNoList = templist?.list || [];
  1732. console.log('batchNoList~~~~', index, batchNoList);
  1733. // 设置批次列表
  1734. this.$set(
  1735. this.form.datasource[index],
  1736. 'batchNoList',
  1737. batchNoList
  1738. );
  1739. // 查找批次号是否存在批次列表
  1740. const batchNo = batchNoList.find(i => i.batchNo == item.batchNo);
  1741. console.log('batchNo~~~~', index, batchNo);
  1742. // 存在
  1743. if (batchNo) {
  1744. // 设置批次ID
  1745. this.$set(
  1746. this.form.datasource[index],
  1747. 'batchStockId',
  1748. batchNo.id
  1749. );
  1750. // 设置批次库存
  1751. this.$set(
  1752. this.form.datasource[index],
  1753. 'warehouseNum',
  1754. batchNo.measureQuantity || 0
  1755. );
  1756. } else { //不存在
  1757. // 批次列表添加不存在的批次号对象
  1758. batchNoList = batchNoList.push({
  1759. batchNo: item.batchNo,
  1760. id: 999,
  1761. measureQuantity: 0
  1762. })
  1763. // 设置为不存在的批次ID
  1764. this.$set(
  1765. this.form.datasource[index],
  1766. 'batchStockId',
  1767. 999
  1768. );
  1769. this.$set(
  1770. this.form.datasource[index],
  1771. 'warehouseNum',
  1772. ''
  1773. );
  1774. }
  1775. }
  1776. // 如果没有仓库列表
  1777. else {
  1778. console.log('333~~~~', index);
  1779. // 通过产品编码查仓库
  1780. const tempWarehouse = await getIdWarehouseList({
  1781. categoryId: item.productId,
  1782. })
  1783. // 有仓库列表
  1784. if (tempWarehouse?.length) {
  1785. console.log('666~~~~', index, tempWarehouse);
  1786. this.$set(
  1787. this.form.datasource[index],
  1788. 'warehouseList',
  1789. tempWarehouse
  1790. );
  1791. if (item.warehouseId) {
  1792. this.$set(
  1793. this.form.datasource[index],
  1794. 'warehouseNum',
  1795. await getWarehouseOutStock({
  1796. warehouseId: item.warehouseId,
  1797. code: item.productCode
  1798. })
  1799. );
  1800. } else {
  1801. if (this.form.datasource[index]?.warehouseList?.length) {
  1802. this.$set(
  1803. this.form.datasource[index],
  1804. 'warehouseId',
  1805. this.form.datasource[index]?.warehouseList[0].warehouseId
  1806. );
  1807. await this.warehouseChange(index, this.form.datasource[index]);
  1808. }
  1809. }
  1810. const templist1 = await getBatchList({
  1811. categoryCode: item.productCode,
  1812. warehouseId: item.warehouseId,
  1813. size: -1
  1814. });
  1815. let tempBatchNoList = templist1?.list || [];
  1816. console.log('888~~~~', index, item.batchNo);
  1817. tempBatchNoList.push({
  1818. batchNo: item.batchNo,
  1819. id: 999,
  1820. measureQuantity: 0
  1821. })
  1822. console.log('tempBatchNoList~~~~', index, tempBatchNoList);
  1823. // 批次号
  1824. this.$set(
  1825. this.form.datasource[index],
  1826. 'batchNoList',
  1827. tempBatchNoList
  1828. );
  1829. this.$set(
  1830. this.form.datasource[index],
  1831. 'batchStockId',
  1832. 999
  1833. );
  1834. this.$set(
  1835. this.form.datasource[index],
  1836. 'warehouseNum',
  1837. ''
  1838. );
  1839. }
  1840. }
  1841. },
  1842. remove(i) {
  1843. this.form.datasource.splice(i, 1);
  1844. this.setSort();
  1845. },
  1846. // 重新排序
  1847. setSort() {
  1848. this.form.datasource.forEach((n, index) => {
  1849. n.key = index + 1;
  1850. });
  1851. },
  1852. //选择产品
  1853. handParent() {
  1854. if (!this.orderId && !this.orderIds)
  1855. return this.$message.error('请先选择订单');
  1856. this.$refs.BIZproductListRef.open('', -1);
  1857. },
  1858. // 添加
  1859. handlAdd() {
  1860. if (!this.orderId && !this.orderIds)
  1861. return this.$message.error('请先选择订单');
  1862. this.$refs.productListRef.open(this.oldProductList);
  1863. },
  1864. //库存台账
  1865. selectStockLedgerDialogOpen(row) {
  1866. this.current = row;
  1867. this.$refs.selectStockLedgerDialogRef.open();
  1868. },
  1869. validateForm(callback) {
  1870. //开始表单校验
  1871. this.$refs.form.validate((valid, obj) => {
  1872. let is = false;
  1873. let isBatchNo = false;
  1874. let isSuspend = false;
  1875. this.form.datasource.forEach((item) => {
  1876. if (Number(item.totalCount) > item.orderTotalCount) {
  1877. is = true;
  1878. }
  1879. if (item.batchStockId == 999) {
  1880. isBatchNo = true;
  1881. }
  1882. if(item.isSuspend == 1 && (Number(item.totalCount) > item.warehouseNum)) {
  1883. isSuspend = true;
  1884. }
  1885. });
  1886. // 退货单退货不校验数量,实物赔偿无法计算
  1887. if (is && this.sourceType != 3) {
  1888. this.$message.warning('发货数量大于订单总数量');
  1889. if (this.isTotalCount == 1) {
  1890. callback(false);
  1891. }
  1892. }
  1893. if (isBatchNo) {
  1894. this.$message.warning('你填的批次号与库存批次号不相符,请重新选择批次号出库或删除批次号');
  1895. callback(false);
  1896. }
  1897. if (isSuspend) {
  1898. this.$message.warning('挂起产品发货数量不能大于库存');
  1899. callback(false);
  1900. }
  1901. if (obj) {
  1902. let messages = Object.keys(obj).map((key) => obj[key][0]);
  1903. if (messages.length > 0) {
  1904. this.$message.warning(messages[0].message);
  1905. }
  1906. }
  1907. callback(valid);
  1908. });
  1909. },
  1910. /**
  1911. * 优化后的表单校验方法 - 重构版本
  1912. * 添加了详细的注释、错误消息常量和更清晰的结构
  1913. */
  1914. validateFormOptimized(callback) {
  1915. // 使用常量存储错误消息
  1916. const ERROR_MESSAGES = {
  1917. QUANTITY_EXCEEDS_ORDER: '发货数量大于订单总数量',
  1918. BATCH_NUMBER_INVALID: '你填的批次号与库存批次号不相符,请重新选择批次号出库或删除批次号',
  1919. SUSPENDED_PRODUCT_OVERSTOCK: '挂起产品发货数量不能大于库存'
  1920. };
  1921. // 开始表单校验
  1922. this.$refs.form.validate((valid, obj) => {
  1923. // 收集所有校验错误
  1924. const errors = [];
  1925. // 遍历数据源进行业务规则校验
  1926. this.form.datasource.forEach((item, index) => {
  1927. const productInfo = this.getProductDisplayInfo(item);
  1928. // 检查数量是否超过订单数量(退货单除外)
  1929. if (this.isQuantityExceedsOrder(item)) {
  1930. if (this.sourceType != 3) { // 非退货单
  1931. errors.push({
  1932. type: 'quantity',
  1933. message: `产品[${productInfo.name}]的发货数量${item.totalCount}大于订单总数量${item.orderTotalCount}`,
  1934. stopValidation: this.isTotalCount == 1,
  1935. item: item
  1936. });
  1937. }
  1938. }
  1939. // 检查批次号是否正确
  1940. // if (this.isBatchNumberInvalid(item)) {
  1941. // errors.push({
  1942. // type: 'batch',
  1943. // message: `产品[${productInfo.name}]填写的批次号与库存批次号不相符,请重新选择批次号出库或删除批次号`,
  1944. // stopValidation: true,
  1945. // item: item
  1946. // });
  1947. // }
  1948. if (this.isBatchNumberInvalid(item) && item.isSuspend != 1) {
  1949. // 获取当前批次号和正确的库存批次号信息
  1950. const currentBatchNumber = item.batchNo || '未填写';
  1951. // const availableBatches = item.availableBatchNumbers || item.validBatchNumbers || [];
  1952. // const batchInfo = availableBatches.length > 0
  1953. // ? `当前可选择批次号:${availableBatches.join('、')}`
  1954. // : '当前无有效批次';
  1955. errors.push({
  1956. type: 'batch',
  1957. message: `第${index + 1}条产品[${productInfo.name}]填写的批次号"${currentBatchNumber}"与库存批次号不相符,请重新选择批次号出库或删除批次号`,
  1958. stopValidation: true,
  1959. item: item
  1960. });
  1961. }
  1962. // 检查产品库存
  1963. if (this.isProductOverstock(item)) {
  1964. errors.push({
  1965. type: 'suspend',
  1966. message: `产品[${productInfo.name}]的发货数量${item.totalCount}不能大于库存${item.warehouseNum}`,
  1967. stopValidation: true,
  1968. item: item
  1969. });
  1970. }
  1971. });
  1972. // 如果存在错误,显示第一个错误并根据情况终止校验
  1973. if (errors.length > 0) {
  1974. this.$message.warning(errors[0].message);
  1975. if (errors[0].stopValidation) {
  1976. callback(false);
  1977. return;
  1978. }
  1979. }
  1980. // 显示表单字段错误(如果存在)
  1981. if (obj) {
  1982. let messages = Object.keys(obj).map((key) => obj[key][0]);
  1983. if (messages.length > 0) {
  1984. this.$message.warning(messages[0].message);
  1985. }
  1986. }
  1987. callback(valid);
  1988. });
  1989. },
  1990. /**
  1991. * 检查数量是否超过订单数量
  1992. * @param {Object} item 数据项
  1993. * @returns {boolean} 是否超过
  1994. */
  1995. isQuantityExceedsOrder(item) {
  1996. return Number(item.totalCount) > item.orderTotalCount;
  1997. },
  1998. /**
  1999. * 检查批次号是否无效
  2000. * @param {Object} item 数据项
  2001. * @returns {boolean} 是否无效
  2002. */
  2003. isBatchNumberInvalid(item) {
  2004. return item.batchStockId == 999;
  2005. },
  2006. /**
  2007. * 检查挂起产品是否超过库存
  2008. * @param {Object} item 数据项
  2009. * @returns {boolean} 是否超过
  2010. */
  2011. isProductOverstock(item) {
  2012. return Number(item.totalCount) > item.warehouseNum;
  2013. },
  2014. /**
  2015. * 获取产品显示信息
  2016. * @param {Object} item 数据项
  2017. * @returns {Object} 包含产品名称和编码的对象
  2018. */
  2019. getProductDisplayInfo(item) {
  2020. return {
  2021. name: item.productName || item.name || '未知产品',
  2022. code: item.productCode || item.code || '',
  2023. info: item.productName && item.productCode
  2024. ? `${item.productName}(${item.productCode})`
  2025. : (item.productName || item.name || '未知产品')
  2026. };
  2027. }
  2028. }
  2029. };
  2030. </script>
  2031. <style lang="scss" scoped>
  2032. ::v-deep .el-table .warning-row {
  2033. background: #d9ecff;
  2034. }
  2035. .headbox {
  2036. display: flex;
  2037. justify-content: flex-start;
  2038. align-items: center;
  2039. .amount {
  2040. font-size: 14px;
  2041. font-weight: bold;
  2042. padding-right: 30px;
  2043. }
  2044. }
  2045. .time-form .el-form-item {
  2046. margin-bottom: 0 !important;
  2047. }
  2048. ::v-deep .period {
  2049. display: flex;
  2050. .borderleftnone {
  2051. .el-input--medium .el-input__inner {
  2052. border-top-right-radius: 0;
  2053. border-bottom-right-radius: 0;
  2054. }
  2055. }
  2056. .borderrightnone {
  2057. .el-input--medium .el-input__inner {
  2058. border-top-left-radius: 0;
  2059. border-bottom-left-radius: 0;
  2060. }
  2061. }
  2062. }
  2063. ::v-deep .time-form tbody > tr:hover > td {
  2064. background-color: transparent !important;
  2065. }
  2066. // ::v-deep .time-form .el-table tr {
  2067. // background-color: #ffffff;
  2068. // }
  2069. .pricebox {
  2070. display: flex;
  2071. justify-content: flex-start;
  2072. align-items: center;
  2073. font-weight: bold;
  2074. }
  2075. </style>