bind-barcode-grouping.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <!-- @desc:分组粘贴 @auth:寇珊珊 @time:2023年4月20日16:00:36 -->
  2. <template>
  3. <div class="main-div" ref="mainDiv">
  4. <!--加载中-->
  5. <loading :loading="loading" v-if="!modalVisible"></loading>
  6. <DkPageButton :total="editKeys?editKeys.length:0"
  7. :current="editIndex"
  8. v-if="editKeys && editKeys.length > 1"
  9. @pageChange="editPageChange"></DkPageButton>
  10. <DkCollapse ref="collapse" @on-change="changeCollapse">
  11. <DkPanel prop="essentialInformation">
  12. <!-- 下拉区域 -->
  13. <DkForm slot="content" ref="formInline" v-model="formData" style="width: 95%">
  14. <!--成型日期-->
  15. <DkFormItem prop="moldingDate">
  16. <DatePickerPop ref="moldingDate" v-model="formData.moldingDate" :readonly="true"/>
  17. </DkFormItem>
  18. <!--起始条码-->
  19. <DkFormItem prop="produceBarCode">
  20. <InputPop :readonly="productUniqueCodeCount==moldingRecordList.length" ref="produceBarCode"
  21. v-model="formData.produceBarCode"/>
  22. </DkFormItem>
  23. <!-- 绑定条码 -->
  24. <DkButton :disabled="productUniqueCodeCount==moldingRecordList.length" type="primary"
  25. @click="bindBarcodeButton" style="margin-right: 10px">{{ $v('bindBarcode') }}
  26. </DkButton>
  27. <!-- 清空条码 -->
  28. <DkButton :disabled="productUniqueCodeCount==moldingRecordList.length"
  29. style="margin-right: 10px" @click="clearBindBarcode">{{
  30. $v('clearBindBarcode') }}
  31. </DkButton>
  32. <!-- 撤销条码 -->
  33. <DkButton :disabled="productUniqueCodeCount==0" @click="revokeBindBarcode">{{
  34. $v('revokeBindBarcode') }}
  35. </DkButton>
  36. </DkForm>
  37. </DkPanel>
  38. <DkPanel prop="moldingRecordRelation">
  39. <div slot="content" :style="'height: ' + tableHeight + 'px'">
  40. <!--添加行按钮-->
  41. <DkButton slot="content" type="success" @click="openAddDetailModal" size="small" :disabled="addRowFlag"
  42. style="float: left;position: absolute; top: 95px;left: 140px;">{{ $v('saveDetail') }}
  43. </DkButton>
  44. <!--型记录信息-->
  45. <EditTreeTable ref="moldingRecord" :data="moldingRecordList" showFooter
  46. major-field="id"
  47. :operate-flag="false"
  48. :height="tableHeight"
  49. :new-row-flag="false"
  50. @changeValue="changeValue"
  51. :columns="moldingRecordTreeColumns"
  52. exchangeField="pdtModelId"
  53. controlId="pdtModelId"
  54. :bindBarCodeFlag="true"
  55. @current-change="getDetailAdd"
  56. @check-detail-by-bind-bar-code="checkDetail"
  57. @add-detail-by-bind-bar-code="addDetail"
  58. ></EditTreeTable>
  59. </div>
  60. </DkPanel>
  61. </DkCollapse>
  62. <!-- 下部分按钮区域-->
  63. <DkSaveButton ref="saveButton" :loading="loading" @save="save" @close="close"></DkSaveButton>
  64. </div>
  65. </template>
  66. <script>
  67. import { formMixin } from '@/mixins/form'
  68. export default {
  69. name: 'bind-barcode-grouping',
  70. mixins: [formMixin],
  71. data() {
  72. let self = this
  73. return {
  74. tableData: [],
  75. loading: false,
  76. tableHeight: 620,
  77. params: null,
  78. // 画面表单数据
  79. formData: {
  80. moldingDate: new Date().toDateStr(),
  81. ftyId: this.$store.state.user.ftyId,
  82. produceBarCode: null,//起始条码
  83. },
  84. moldingRecordList: [],// 成型记录明细信息
  85. // 成型记录明细列表
  86. productUniqueCodeCount: 0,//绑定条码个数(如果长度和查询数据长度一致则不能进行绑定条码)
  87. //成型记录明细列表
  88. moldingRecordTreeColumns: [
  89. {
  90. field: 'checkBoxFlag', type: 'checkbox', width: 'auto', childCanInput: false, equal: true,
  91. },
  92. // 分组序号
  93. {
  94. field: 'moldlineItemNo', title: self.$t('bondingNo'),
  95. dataType: self.$config.tableSelectType.product, controlId: 'pdtModelId',
  96. treeNode: true, type: 'disabled', width: 'auto'
  97. },
  98. // 分组名称 todo
  99. // { field: 'moldlineItemCode', title: self.$t('repPdtModelName'), type: 'disabled', width: 'auto' },
  100. // 成型线编码
  101. { field: 'uniqueCode', title: self.$t('moldlineCode'), type: 'disabled', width: 'auto' },
  102. // 成型线名称
  103. { field: 'moldlineName', type: 'disabled', width: 'auto' },
  104. // 成型班长
  105. { field: 'manageUserName', type: 'disabled', width: 'auto' },
  106. // 成型工号
  107. { field: 'moldingUserName', type: 'disabled', width: 'auto' },
  108. // 产品编码
  109. { field: 'modelCode', title: self.$t('productCode'), type: 'disabled', width: 'auto' },
  110. // 产品名称
  111. { field: 'modelName', title: self.$t('productName'), type: 'disabled', width: 'auto' },
  112. // 模具状态
  113. { field: 'moldlineItemKindName', title: self.$t('mouldKindName'), type: 'disabled', width: 'auto' },
  114. // 绑码标识
  115. // {field: 'flgBindUnique', type: 'switch', width: 'auto'},
  116. // 绑定条码
  117. {
  118. field: 'productUniqueCode',
  119. title: self.$t('pdtUniqueCode'),
  120. childCanInput: false,
  121. equal: true,
  122. type: 'text',
  123. width: 'auto'
  124. },
  125. // 成型批次
  126. { field: 'moldingBatch', type: 'disabled', width: 'auto' },
  127. // 成型标识
  128. { field: 'flgMolding', type: 'disabled', switch: true, controlId: 'flgMolding', width: '120px' },
  129. // { field: 'flgMolding', type: 'switch', controlId: 'flgMolding', width: '120px' },
  130. // 未成型原因
  131. { field: 'unmoldedReasonName', type: 'disabled', width: 'auto' },
  132. // 产品商标
  133. { field: 'logoName', type: 'disabled', width: 'auto' },
  134. // 釉色
  135. { field: 'colourName', type: 'disabled', width: 'auto' },
  136. // 损坯标识
  137. { field: 'flgScrap', type: 'disabled', switch: true, width: '120px' },
  138. // 损坯原因
  139. { field: 'scrapReasonName', type: 'disabled', width: 'auto' },
  140. // 备注
  141. { field: 'productRemarks', type: 'text', width: 'auto' },
  142. ],
  143. //商品条码-数字正则
  144. checkProduceBarCode: function (value) {
  145. const reg = /^.*\d+.*$/
  146. if (value === '' || value === undefined || value === null) {
  147. return true
  148. } else {
  149. if ((!reg.test(value)) && value !== '') {
  150. return false
  151. } else {
  152. return true
  153. }
  154. }
  155. },
  156. addRowFlag: true,//保存至明细可用标识
  157. row: {},//记录当前选择行数据
  158. }
  159. },
  160. methods: {
  161. /**
  162. * @desc : 绑定条码
  163. * @date : 2023/2/28 13:03
  164. * @author : 寇珊珊
  165. */
  166. bindBarcodeButton() {
  167. if (!this.formData.produceBarCode) {
  168. this.$Message.warning(this.$t('W_109'))
  169. return
  170. }
  171. if (!this.checkProduceBarCode(this.formData.produceBarCode)) {
  172. this.$Message.warning(this.$t('W_104'))
  173. return
  174. }
  175. let reg = /(\d+)/g
  176. let match = null
  177. //截取的数字
  178. let lastNum = null
  179. let beforeStr = null
  180. let lastStr = null
  181. while ((match = reg.exec(this.formData.produceBarCode)) !== null) {
  182. lastNum = match[1]
  183. // 数字下标
  184. let lastNumIndex = parseInt(this.formData.produceBarCode.lastIndexOf(lastNum))
  185. //截取下标前字符
  186. beforeStr = this.formData.produceBarCode.substr(0, lastNumIndex)
  187. //截取下标后字符
  188. lastStr = this.formData.produceBarCode.substr(lastNumIndex + parseInt(lastNum.length)).toString()
  189. }
  190. let index = 0
  191. let zeroFlag = true
  192. let zeroStr = ''
  193. if (lastNum.length > 1 && lastNum.substring(0, 1) == '0') {
  194. zeroFlag = false
  195. for (let it of lastNum) {
  196. if (it == '0') {
  197. zeroStr += '0'
  198. } else {
  199. break
  200. }
  201. }
  202. }
  203. //条码数字长度
  204. let indexLength = (parseInt(lastNum) + parseInt(index)).toString().length
  205. for (let i = 0; i < this.moldingRecordList.length; i++) {
  206. if (this.moldingRecordList[i].productUniqueCodeFlag || this.moldingRecordList[i].canProductUniqueCode) {
  207. let number = parseInt(lastNum) + parseInt(index)
  208. //每次多一位数,就去掉前面一个0
  209. if (indexLength != number.toString().length) {
  210. if (zeroStr.length == 0) {
  211. break
  212. }
  213. zeroStr = zeroStr.substring(0, zeroStr.length - 1)
  214. indexLength = number.toString().length
  215. }
  216. //数字在前
  217. if (beforeStr.length == 0) {
  218. if (zeroFlag) {
  219. this.$set(this.moldingRecordList[i], 'productUniqueCode', number + beforeStr + lastStr)
  220. } else {
  221. this.$set(this.moldingRecordList[i], 'productUniqueCode', zeroStr + number + beforeStr + lastStr)
  222. }
  223. }
  224. //数字在后
  225. else if (lastStr.length == 0) {
  226. if (zeroFlag) {
  227. this.$set(this.moldingRecordList[i], 'productUniqueCode', beforeStr + lastStr + number)
  228. } else {
  229. this.$set(this.moldingRecordList[i], 'productUniqueCode', beforeStr + lastStr + zeroStr + number)
  230. }
  231. }
  232. //数字在中
  233. else {
  234. if (zeroFlag) {
  235. this.$set(this.moldingRecordList[i], 'productUniqueCode', beforeStr + number + lastStr)
  236. } else {
  237. this.$set(this.moldingRecordList[i], 'productUniqueCode', beforeStr + zeroStr + number + lastStr)
  238. }
  239. }
  240. this.$set(this.moldingRecordList[i], 'productUniqueCodeFlag', true)
  241. this.$set(this.moldingRecordList[i], 'productUniqueFlag', true)
  242. index++
  243. //给每个总单下的明细【绑定条码赋值】
  244. for (let item = 0; item < this.moldingRecordList[i].bomItems.length; item++) {
  245. //从后台数据查出来绑定条码已经存在的不需要赋值
  246. if (!this.moldingRecordList[i].bomItems[item].readOnlyUniqueCode) {
  247. this.$set(this.moldingRecordList[i].bomItems[item], 'productUniqueCode', this.moldingRecordList[i].productUniqueCode)
  248. this.$set(this.moldingRecordList[i].bomItems[item], 'productUniqueCodeFlag', true)
  249. this.$set(this.moldingRecordList[i].bomItems[item], 'productUniqueFlag', true)
  250. }
  251. }
  252. }
  253. }
  254. this.$refs.moldingRecord.tableData = this.moldingRecordList
  255. // 处理子级数据
  256. this.$refs.moldingRecord.loadChildrenInit(this.moldingRecordList, ['productUniqueCode'])
  257. // 重新刷新
  258. this.$refs.moldingRecord.reloadTreeTable(this.moldingRecordList)
  259. },
  260. /**
  261. * @desc : 清空条码
  262. * @date : 2023/2/28 13:04
  263. * @author : 寇珊珊
  264. */
  265. clearBindBarcode() {
  266. this.formData.produceBarCode = null
  267. for (let i of this.moldingRecordList) {
  268. if (!i.readOnlyUniqueCode) {
  269. i.productUniqueCode = null
  270. i.productUniqueCodeFlag = false
  271. i.productUniqueFlag = false
  272. }
  273. //清空每条总单下明细的绑定条码
  274. for (let item of i.bomItems) {
  275. if (!item.readOnlyUniqueCode) {
  276. item.productUniqueCode = null
  277. item.productUniqueCodeFlag = false
  278. item.productUniqueFlag = false
  279. }
  280. }
  281. }
  282. // 处理子级数据
  283. this.$refs.moldingRecord.loadChildrenInit(this.moldingRecordList, ['productUniqueCode'])
  284. this.$refs.moldingRecord.reloadData(this.moldingRecordList)
  285. },
  286. /**
  287. * @desc : 撤销条码
  288. * @date : 2023/5/8 9:53
  289. * @author : 寇珊珊
  290. */
  291. revokeBindBarcode() {
  292. let list = this.$refs['moldingRecord'].tableData.filter(it=>it.checkBoxFlag)
  293. let pdtUniqueIdList = []
  294. for (let item of list) {
  295. for (let it of item.bomItems) {
  296. if (it.pdtUniqueId) {
  297. pdtUniqueIdList.push(it.pdtUniqueId)
  298. }
  299. }
  300. }
  301. if (pdtUniqueIdList.length == 0) {
  302. this.$Message.warning(this.$t('W_150'))
  303. return
  304. }
  305. this.excute(this.$service.productService, this.$service.productService.undo, pdtUniqueIdList).then(res => {
  306. if (res.code === this.$config.SUCCESS_CODE) {
  307. this.$Message.success(res.message)
  308. this.detail(this.$route.params.id)
  309. } else {
  310. this.$Message.warning(res.message)
  311. }
  312. })
  313. },
  314. /**
  315. * @desc : 值改变
  316. * @date : 2023/2/28 11:23
  317. * @author : 寇珊珊
  318. */
  319. changeValue(value) {
  320. if (value && value.field) {
  321. let field = value.field
  322. let row = value.row
  323. let rowIndex = value.rowIndex
  324. if (value.field == 'productUniqueCode') {
  325. this.$set(this.moldingRecordList[rowIndex], field, row[field])
  326. this.$set(this.moldingRecordList[rowIndex], 'productUniqueFlag', true)
  327. row.productUniqueFlag = true
  328. //改变每条总单下明细的绑定条码
  329. for (let item = 0; item < row.bomItems.length; item++) {
  330. //从后台数据查出来绑定条码已经存在的不需要赋值;
  331. if (!row.bomItems[item].readOnlyUniqueCode) {
  332. this.$set(row.bomItems[item], 'productUniqueFlag', true)
  333. this.$set(row.bomItems[item], 'productUniqueCode', row[field])
  334. }
  335. //修改备注也要修改productUniqueFlag标识 用于后续保存数据过滤
  336. if (field == 'productRemarks') {
  337. this.$set(row.bomItems[item], 'productUniqueFlag', true)
  338. }
  339. }
  340. for (let i = 0; i < this.moldingRecordList.length; i++) {
  341. if (this.moldingRecordList[i].id == row.id) {
  342. this.moldingRecordList[i] = row
  343. }
  344. }
  345. this.$refs.moldingRecord.tableData = this.moldingRecordList
  346. // 处理子级数据
  347. this.$refs.moldingRecord.loadChildrenInit(this.moldingRecordList, ['productUniqueCode'])
  348. // 重新刷新
  349. this.$refs.moldingRecord.reloadTreeTable(this.moldingRecordList)
  350. }
  351. }
  352. },
  353. /**
  354. * @desc : 替换子集
  355. * @date : 2023/4/24 15:09
  356. * @author : 寇珊珊
  357. */
  358. checkDetail(oldRow, newRow) {
  359. for (let it of this.moldingRecordList) {
  360. let index = 0
  361. for (let item of it.bomItems) {
  362. if (item.id == oldRow.id) {
  363. newRow.moldingItemId = newRow.itemId
  364. item = Object.assign(item, newRow)
  365. index++
  366. break
  367. }
  368. }
  369. }
  370. this.$refs.moldingRecord.reloadData(this.moldingRecordList)
  371. },
  372. /**
  373. * @desc : 获取添加子集
  374. * @date : 2023/4/27 10:11
  375. * @author : 寇珊珊
  376. */
  377. getDetailAdd(e) {
  378. if (e && e.column && !e.column.field) {
  379. return
  380. }
  381. //只存父级
  382. if (e && e.row && e.row.hasChild == 1) {
  383. this.row = e.row
  384. this.addRowFlag = false
  385. } else {
  386. this.addRowFlag = true
  387. }
  388. },
  389. /**
  390. * @desc : 添加子集
  391. * @date : 2023/4/27 10:03
  392. * @author : 寇珊珊
  393. */
  394. openAddDetailModal() {
  395. //父级成型线下产品个数不存在,或者父级下成型线下产品个数和父级明细个数不相等
  396. if (this.row) {
  397. if (!this.row.modelCount || (this.row.modelCount && this.row.modelCount != this.row.bomItems.length)) {
  398. //赋值查询类型
  399. this.$refs.moldingRecord.focusedRow = this.row
  400. //加载数据
  401. this.$refs.moldingRecord.getDataTable(this.row)
  402. } else {
  403. this.$Message.warning(this.$t('W_143'))
  404. }
  405. } else {
  406. this.$Message.warning(this.$t('W_142'))
  407. }
  408. },
  409. /**
  410. * @desc : 将选择后的数据添加至明细
  411. * @date : 2023/4/27 14:41
  412. * @author : 寇珊珊
  413. */
  414. addDetail(row) {
  415. this.addRowFlag = false
  416. for (let it of this.moldingRecordList) {
  417. if (this.row.id == it.id) {
  418. row.parentId = it.id
  419. row.moldingItemId = row.itemId
  420. this.$set(row, 'readOnly', ['productUniqueCode'])
  421. it.bomItems.push(row)
  422. }
  423. it.modelCount = row.modelCount
  424. }
  425. // 处理子级数据
  426. this.$refs.moldingRecord.loadChildrenInit(this.moldingRecordList, ['productUniqueCode'])
  427. this.$refs.moldingRecord.reloadData(this.moldingRecordList)
  428. },
  429. /**
  430. * @desc : 通过id查询
  431. * @date : 2023/2/28 11:25
  432. * @author : 寇珊珊
  433. */
  434. detail(id) {
  435. //绑定条码计数 每次查询之前要清零(因为保存后要重新调用)
  436. this.productUniqueCodeCount = 0
  437. let param = {
  438. 'moldlineId': parseInt(id),
  439. 'pdtGlueKind': this.$route.query.pdtGlueKind,
  440. 'moldingBatch': this.$route.query.moldingBatch,
  441. 'moldingDate': this.$route.query.moldingDate,
  442. 'ftyId': this.$store.state.user.ftyId
  443. }
  444. return this.excute(this.$service.moldingRecordItemService, this.$service.moldingRecordItemService.selectByMoldineId, param).then(res => {
  445. if (res.code === this.$config.SUCCESS_CODE) {
  446. this.formData.moldingDate = this.$route.query.moldingDate
  447. let list = res.data
  448. this.moldingRecordList = list
  449. let index = 0
  450. for (let i of this.moldingRecordList) {
  451. i.pdtModelId = this.$config.bindBarCodePdtModelId.parentId
  452. i.modelCount = i.bomItems[0].modelCount
  453. //明细已有绑定条码个数
  454. let productUniqueCodeLength = 0
  455. //明细已有成型标识个数
  456. let flgMoldingLength = 0
  457. //明细下标
  458. let itemIndex = 0
  459. //明细第一条的绑定条码
  460. let zeroCode = null
  461. //循环明细
  462. for (let item of i.bomItems) {
  463. item.moldingItemId = item.itemId
  464. //如果明细第一条绑定条码有值 存起来
  465. if (itemIndex == 0 && item.productUniqueCode) {
  466. zeroCode = item.productUniqueCode
  467. }
  468. //明细的绑定条码不可以修改
  469. this.$set(item, 'readOnly', ['productUniqueCode'])
  470. //如果明细里绑定条码存在没值的情况;总单绑定条码可以输入 反之不可以;明细有值没值都要禁用
  471. if (item.productUniqueCode) {
  472. item.exchangeFlag = false
  473. productUniqueCodeLength++
  474. item.readOnlyUniqueCode = true
  475. }
  476. //明细不是成型
  477. if (!item.flgMolding) {
  478. item.exchangeFlag = false
  479. flgMoldingLength++
  480. }
  481. itemIndex++
  482. }
  483. //明细中每条绑定条码都有值 = 每条总单下的明细数量 或者 是成型标识数量大于0
  484. if (productUniqueCodeLength == i.bomItems.length || flgMoldingLength > 0) {
  485. i.readOnlyUniqueCode = true
  486. //明细第一条绑定条码赋值给父级
  487. this.$set(this.moldingRecordList[index], 'productUniqueCode', zeroCode)
  488. //不可更改绑定条码
  489. this.$set(this.moldingRecordList[index], 'canProductUniqueCode', false)
  490. //绑定条码改为只读
  491. this.$set(i, 'readOnly', ['productUniqueCode'])
  492. //绑定条码总条数累加
  493. this.productUniqueCodeCount++
  494. //总单成型标识(根据明细里是否全是成型标识)
  495. } else {
  496. //可更改绑定条码
  497. this.$set(this.moldingRecordList[index], 'canProductUniqueCode', true)
  498. //撤销条码复选框是否可用
  499. this.$set(i, 'disabled', true)
  500. }
  501. index++
  502. }
  503. }
  504. })
  505. },
  506. /**
  507. * @desc : 设置传参
  508. * @date : 2023/2/28 11:29
  509. * @author : 寇珊珊
  510. */
  511. setParams() {
  512. //productUniqueFlag 校验手动改变绑定条码标识
  513. let list = []
  514. if (this.moldingRecordList.length > 0) {
  515. //提取明细信息
  516. for (let it of this.moldingRecordList.filter(it => it.productUniqueFlag)) {
  517. let bomItems = it.bomItems.filter(item => item.productUniqueFlag)
  518. list.push({
  519. moldingItemIds: bomItems.map(map => map.moldingItemId),
  520. ftyId: bomItems[0].ftyId,
  521. moldingItemId: bomItems[0].moldingItemId,
  522. uniqueId: bomItems[0].productId,
  523. uniqueCode: bomItems[0].productId ? null : it.productUniqueCode,
  524. remarks: it.productRemarks,
  525. flgPdtGlue: true,
  526. modelId: bomItems[0].repPdtModelId,
  527. })
  528. }
  529. }
  530. this.params = list
  531. },
  532. /**
  533. * @desc : 保存数据
  534. * @date : 2023/2/28 11:28
  535. * @author : 寇珊珊
  536. */
  537. save() {
  538. //验重
  539. if (!this.checkData()) {
  540. return
  541. }
  542. this.setParams()
  543. let excute = this.excute(this.$service.productService, this.$service.productService.insertBatch, this.params)
  544. excute.then(res => {
  545. if (res.code === this.$config.SUCCESS_CODE) {
  546. this.$Message.success(res.message)
  547. this.detail(this.$route.params.id)
  548. } else {
  549. this.$Message.warning(res.message)
  550. }
  551. })
  552. return excute
  553. },
  554. /**
  555. * @desc : 验重
  556. * @date : 2023/3/3 14:30
  557. * @author : 寇珊珊
  558. */
  559. checkData() {
  560. let codeNoList = []
  561. //校验绑定条码
  562. codeNoList = codeNoList.concat(this.moldingRecordList.copy().filter(f => f.productUniqueCode).map(m => m.productUniqueCode))
  563. if (codeNoList.length != codeNoList.unique().length) {
  564. this.$Message.warning(this.$t('W_110'))
  565. return false
  566. }
  567. //todo 判断每组数据是否达到可保存数量
  568. //如果本次都不需要绑定条码
  569. if (this.productUniqueCodeCount != this.moldingRecordList.length) {
  570. //过滤掉总单中本次不需要进行绑定条码的数据
  571. for (let i of this.moldingRecordList.filter(it => !it.readOnlyUniqueCode)) {
  572. if (!i.modelCount || i.modelCount && i.modelCount != i.bomItems.length) {
  573. this.$Message.warning(this.$t('W_144'))
  574. return false
  575. }
  576. }
  577. }
  578. return true
  579. },
  580. },
  581. created() {
  582. this.resizeTableFlag = true // 计算表格高度
  583. },
  584. activated() {
  585. this.detail(this.$route.params.id)
  586. }
  587. }
  588. </script>
  589. <style scoped>
  590. </style>