packingBom.vue 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701
  1. <template>
  2. <view>
  3. <view>
  4. <view class="col userInp" style="display: flex; align-items: center">
  5. <text class="label lable150 rx-cc">是否拆包</text>
  6. <text
  7. v-if="objData.isUnpack == '1' && objData.singleReport == '1'"
  8. style="
  9. color: green;
  10. font-size: 14px;
  11. font-weight: 700;
  12. margin-left: 15px;
  13. "
  14. >是</text
  15. >
  16. <text
  17. v-else-if="isNewUnpack == '1' && objData.singleReport == '0'"
  18. style="
  19. color: green;
  20. font-size: 14px;
  21. font-weight: 700;
  22. margin-left: 15px;
  23. "
  24. >是</text
  25. >
  26. <text
  27. v-else
  28. style="
  29. color: green;
  30. font-size: 14px;
  31. font-weight: 700;
  32. margin-left: 15px;
  33. "
  34. >否</text
  35. >
  36. <u-button
  37. size="small"
  38. class="u-reset-button"
  39. type="primary"
  40. style="margin-left: 40px; width: 80px"
  41. @click="checkUnpack"
  42. v-if="objData.singleReport == '0'"
  43. >手动拆包</u-button
  44. >
  45. </view>
  46. </view>
  47. <view
  48. v-if="
  49. objData.isUnpack == '1' &&
  50. (isNewUnpack == 0 || !isNewUnpack) &&
  51. objData.singleReport == '1'
  52. "
  53. >
  54. <view class="col userInp" style="display: flex; align-items: center">
  55. <text class="label lable150 rx-cc">规格选择:</text>
  56. <!-- multiple -->
  57. <zxz-uni-data-select
  58. :localdata="localdataList"
  59. v-model="Usertype"
  60. @change="changeUserType"
  61. ></zxz-uni-data-select>
  62. </view>
  63. <view class="col userInp" style="display: flex; align-items: center">
  64. <text class="label lable150 rx-cc">包装选择:</text>
  65. <!-- multiple -->
  66. <zxz-uni-data-select
  67. :localdata="warehouseSpecTypeList"
  68. v-model="warehouseId"
  69. @change="changeWarehouseType"
  70. disabled
  71. ></zxz-uni-data-select>
  72. </view>
  73. <view v-if="warehouseId != 1">
  74. <view v-for="(item, i) in DispositionList" :key="i">
  75. <view class="title_box rx-bc">
  76. <!-- 最小包装单元 -->
  77. <view class="name">{{ item.titel }}</view>
  78. <!-- <view class="btn_box rx-bc" @click="handCancelPacking">
  79. 重置打包
  80. </view> -->
  81. </view>
  82. <view class="material">
  83. <view class="content_table">
  84. <view class="item">
  85. <view class="lable rx-cc">包装总数 </view>
  86. <view class="content content_num">
  87. <input
  88. class="uni-input"
  89. v-model="formedNumLast"
  90. type="number"
  91. disabled
  92. @input="changeinput"
  93. />
  94. <view class="unit">{{ item.packageUnit }}</view>
  95. </view>
  96. </view>
  97. <view class="item rx-sc">
  98. <view class="rx ww55">
  99. <view class="lable lable150 rx-cc">{{ item.titel }}单元</view>
  100. <view class="content content_num">
  101. <input
  102. class="uni-input"
  103. v-model="item.packageCell"
  104. disabled
  105. />
  106. <view style="max-width: 100rpx; font-size: 24rpx">{{
  107. item.packageUnit
  108. }}</view>
  109. </view>
  110. </view>
  111. <view class="rx ww45">
  112. <view class="rx-cc ww80">
  113. /<view style="max-width: 100rpx; font-size: 24rpx">{{
  114. item.conversionUnit
  115. }}</view>
  116. </view>
  117. <view class="content rx-sc">
  118. <!-- <zxz-uni-data-select :localdata="unitList" v-model="unit" dataValue='Key'
  119. format='{Value}' dataKey="Key" filterable :clear='false'></zxz-uni-data-select> -->
  120. <!-- <view class="penalize" @click="handleSplit">确认</view> -->
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. <view class="content_table2" v-if="item.splitList.length">
  126. <view class="head row rx-sc">
  127. <view class="item ww10">序号</view>
  128. <view class="item ww15">数量</view>
  129. <view class="item ww20">类型</view>
  130. <view class="item ww20">包装层级</view>
  131. <!-- <view class="item ww20">计量数</view> -->
  132. <view class="item ww40">包装编码</view>
  133. <!-- <view class="item ww10 jsColor" @click="calculation()" v-if="clientEnvironmentId != 3">计算</view>
  134. <view class="item ww10" v-if="clientEnvironmentId == 3"></view> -->
  135. </view>
  136. <view class="table">
  137. <u-list
  138. @scrolltolower="scrolltolower"
  139. class="z_list"
  140. style="height: 100% !important"
  141. >
  142. <view
  143. class="tr row rx-sc"
  144. v-for="(it, idx) in item.splitList"
  145. :key="idx"
  146. >
  147. <view class="item ww10 rx-cc">{{ idx + 1 }}</view>
  148. <view class="item ww15 rx-sc">
  149. <view> {{ it.feedQuantity }}</view>
  150. </view>
  151. <view class="item ww20 rx-sc">
  152. <view v-if="it.rootCategoryLevelId == 2">在制品</view>
  153. <view v-else-if="it.rootCategoryLevelId == 23"
  154. >半成品</view
  155. >
  156. <view v-else-if="it.rootCategoryLevelId == 9">产品</view>
  157. <view v-else-if="it.rootCategoryLevelId == 28">废品</view>
  158. <view v-else>{{ "" }}</view>
  159. </view>
  160. <view class="item ww20 rx-cc">
  161. <view v-if="it.packingType == 4">外包装</view>
  162. <view v-else-if="it.packingType == 2">最小包装</view>
  163. <view v-else-if="it.packingType == 3">内包装</view>
  164. <view v-else>计量</view>
  165. </view>
  166. <view class="item ww40">
  167. {{ it.packingCode }}
  168. </view>
  169. </view>
  170. </u-list>
  171. </view>
  172. </view>
  173. </view>
  174. </view>
  175. </view>
  176. <SearchPopup mode="center" v-if="show">
  177. <template v-slot:list>
  178. <view class="search_list">
  179. <u-form
  180. labelPosition="left"
  181. :model="formData"
  182. labelWidth="180"
  183. labelAlign="left"
  184. class="baseForm"
  185. >
  186. <u-form-item
  187. label="外包装数:"
  188. class="required-form"
  189. borderBottom
  190. prop="assetType"
  191. >
  192. <input
  193. class="uni-input"
  194. v-model="formData.wPackNum"
  195. style="width: 280rpx"
  196. placeholder="外包装数"
  197. />
  198. / {{ splitList[0].unit }}
  199. </u-form-item>
  200. </u-form>
  201. </view>
  202. </template>
  203. <template v-slot:operate>
  204. <view class="operate_box rx-bc">
  205. <u-button
  206. size="small"
  207. class="u-reset-button"
  208. @click="calculationClose()"
  209. >
  210. 取消
  211. </u-button>
  212. <u-button
  213. type="success"
  214. size="small"
  215. class="u-reset-button"
  216. @click="calculationReset()"
  217. >
  218. 重置
  219. </u-button>
  220. <u-button
  221. type="success"
  222. size="small"
  223. class="u-reset-button"
  224. @click="calculationSave()"
  225. >
  226. 确定
  227. </u-button>
  228. </view>
  229. </template>
  230. </SearchPopup>
  231. </view>
  232. <view v-if="isNewUnpack == 1">
  233. <view class="col userInp" style="display: flex; align-items: center">
  234. <text class="label lable150 rx-cc">规格选择:</text>
  235. <!-- multiple -->
  236. <zxz-uni-data-select
  237. :localdata="localdataList"
  238. v-model="Usertype"
  239. @change="changeUserTypeOne"
  240. ></zxz-uni-data-select>
  241. </view>
  242. <view class="material">
  243. <view class="content_table">
  244. <view class="item">
  245. <view class="lable rx-cc">总数</view>
  246. <view class="content content_num">
  247. <input
  248. class="uni-el-input"
  249. v-model="formedNumLast"
  250. type="number"
  251. @input="changeinput"
  252. disabled
  253. style="width: 200px"
  254. />
  255. {{ packageUnit }}
  256. </view>
  257. </view>
  258. </view>
  259. </view>
  260. <view v-if="warehouseId != 1">
  261. <view v-for="(item, i) in DispositionList" :key="i">
  262. <view class="title_box rx-bc">
  263. <!-- 最小包装单元 -->
  264. <view class="name">{{ item.titel }}</view>
  265. </view>
  266. <view class="material">
  267. <view class="content_table">
  268. <view class="item rx-sc">
  269. <view class="lable rx-cc lable150">包装总数 </view>
  270. <view class="content content_num">
  271. <input
  272. class="uni-input"
  273. v-model="item.formedNumLast"
  274. type="number"
  275. disabled
  276. @input="changeinput"
  277. />
  278. <view class="unit">{{ item.conversionUnit }}</view>
  279. </view>
  280. </view>
  281. <view class="item rx-sc">
  282. <view class="rx ww55">
  283. <view class="lable lable150 rx-cc">{{ item.titel }}单元</view>
  284. <view class="content content_num">
  285. <input
  286. class="uni-input"
  287. v-model="item.packageCell"
  288. @input="changeInputPack(item, i)"
  289. :disabled="!item.conversionUnit"
  290. />
  291. <view style="max-width: 100rpx; font-size: 24rpx">{{
  292. item.packageUnit
  293. }}</view>
  294. </view>
  295. </view>
  296. <view class="rx ww45">
  297. <view class="rx-cc ww80">
  298. /<view style="max-width: 100rpx; font-size: 24rpx">{{
  299. item.conversionUnit
  300. }}</view>
  301. </view>
  302. </view>
  303. </view>
  304. </view>
  305. </view>
  306. </view>
  307. <view v-for="item in DispositionList" :key="item.id">
  308. <view class="content_table2" v-if="item.splitList.length != 0">
  309. <view class="head row rx-sc">
  310. <view class="item ww10">序号</view>
  311. <view class="item ww15">数量</view>
  312. <view class="item ww20">类型</view>
  313. <view class="item ww20">包装规格</view>
  314. <!-- <view class="item ww20">计量数</view> -->
  315. <view class="item ww40">包装编码</view>
  316. <!-- <view class="item ww10 jsColor" @click="calculation()" v-if="clientEnvironmentId != 3">计算</view>
  317. <view class="item ww10" v-if="clientEnvironmentId == 3"></view> -->
  318. </view>
  319. <view class="table">
  320. <u-list
  321. @scrolltolower="scrolltolower"
  322. class="z_list"
  323. style="height: 100% !important"
  324. >
  325. <view
  326. class="tr row rx-sc"
  327. v-for="(it, idx) in item.splitList"
  328. :key="idx"
  329. >
  330. <view class="item ww10 rx-cc">{{ idx + 1 }}</view>
  331. <view class="item ww15 rx-sc">
  332. <view> {{ it.feedQuantity }}</view>
  333. </view>
  334. <view class="item ww20 rx-sc">
  335. <view v-if="it.rootCategoryLevelId == 2">在制品</view>
  336. <view v-else-if="it.rootCategoryLevelId == 23">半成品</view>
  337. <view v-else-if="it.rootCategoryLevelId == 9">产品</view>
  338. <view v-else-if="it.rootCategoryLevelId == 28">废品</view>
  339. <view v-else>{{ "" }}</view>
  340. </view>
  341. <view class="item ww20 rx-cc">
  342. <view>{{ packageDispositionData }}</view>
  343. </view>
  344. <view class="item ww40">
  345. {{ it.packingCode }}
  346. </view>
  347. </view>
  348. </u-list>
  349. </view>
  350. </view>
  351. </view>
  352. </view>
  353. </view>
  354. <view>
  355. <uni-popup ref="alertDialog" type="dialog">
  356. <uni-popup-dialog
  357. type="warn"
  358. cancelText="取消"
  359. confirmText="确定"
  360. title="提示"
  361. content="此操作将进行拆包, 是否继续?"
  362. @confirm="dialogConfirm"
  363. @close="dialogClose"
  364. ></uni-popup-dialog>
  365. </uni-popup>
  366. </view>
  367. </view>
  368. </template>
  369. <script>
  370. import { getByCode } from "@/api/pda/common.js";
  371. import {
  372. cancelPacking,
  373. packingReport,
  374. getPackingReport,
  375. packingReportRepeat,
  376. packageDisposition,
  377. getPackingReportRepeat,
  378. getPackingList,
  379. } from "@/api/pda/workOrder.js";
  380. import SearchPopup from "../../components/searchPopup.vue";
  381. export default {
  382. components: {
  383. SearchPopup,
  384. },
  385. props: {
  386. categoryId: {
  387. type: String,
  388. default: "",
  389. },
  390. objData: {
  391. type: Object,
  392. default: () => {},
  393. },
  394. taskId: {
  395. type: String,
  396. default: "",
  397. },
  398. workOrderId: {
  399. type: String,
  400. default: "",
  401. },
  402. },
  403. data() {
  404. return {
  405. formedNumLast: 0,
  406. quantity: "",
  407. unit: "",
  408. Usertype: "", // 规格
  409. unitList: [],
  410. resObj: {},
  411. splitList: [],
  412. localdataList: [],
  413. newDispositionList: [],
  414. DispositionListes: [],
  415. withinQuantity: "", //内包装数量
  416. withinUnit: "", //内包装单位
  417. outsideQuantity: "", //外包装数量
  418. outsideUnit: "", //外包装单位
  419. timeout: null,
  420. packUnit: null,
  421. temporaryNum: 0,
  422. temporaryCount: 0,
  423. temporaryList: [],
  424. packTwoList: [],
  425. DispositionList: [],
  426. selectList: [],
  427. text: "",
  428. value: "",
  429. minimumPackage: [], // 最小包装
  430. withinPackage: [], // 内包装
  431. minimumUnit: "",
  432. outsidePackage: [], //外包装
  433. newCategoryId: "",
  434. warehouseId: 2,
  435. warehouseSpecTypeList: [
  436. {
  437. text: "按计量",
  438. value: 1,
  439. textValue: "按计量",
  440. },
  441. {
  442. text: "最小包装",
  443. value: 2,
  444. textValue: "",
  445. },
  446. {
  447. text: "内包装",
  448. value: 3,
  449. textValue: "",
  450. },
  451. {
  452. text: "外包装",
  453. value: 4,
  454. textValue: "",
  455. },
  456. ],
  457. isNewUnpack: 0,
  458. packageCell: "",
  459. packageUnit: "",
  460. packageOneCell: "",
  461. packageOneUnit: "",
  462. packageTwoCell: "",
  463. packageTwoUnit: "",
  464. packageDispositionData: "",
  465. show: false,
  466. formData: {
  467. wPackNum: null,
  468. },
  469. clientEnvironmentId:
  470. uni.getStorageSync("userInfo") &&
  471. uni.getStorageSync("userInfo").clientEnvironmentId,
  472. };
  473. },
  474. watch: {
  475. categoryId: {
  476. handler(newVal) {
  477. this.newCategoryId = newVal;
  478. },
  479. deep: true,
  480. immediate: true,
  481. },
  482. objData: {
  483. handler(newVal) {
  484. console.log(newVal, "newVal");
  485. if (newVal.product && newVal.product.length) {
  486. console.log(44444);
  487. // this.formedNumLast =
  488. // newVal.formedNumLast || newVal.product[0].feedQuantity;
  489. this.newCategoryId = newVal.product[0].categoryId;
  490. // this.formedNumLast = newVal.product.reduce((acc, pro) => {
  491. // return pro.extInfo.sourceQuantity
  492. // ? acc + Number(pro.extInfo.sourceQuantity)
  493. // : acc;
  494. // }, 0);
  495. this.formedNumLast = newVal.product.reduce((acc, pro) => {
  496. return pro.feedQuantity &&
  497. (!pro.extInfo.isQualified ||
  498. pro.extInfo.isQualified == 1 ||
  499. pro.extInfo.isQualified == 3) &&
  500. !pro.extInfo.isLoss
  501. ? this.add(acc, Number(pro.feedQuantity))
  502. : acc;
  503. }, 0);
  504. } else if (newVal.semiProductList && newVal.semiProductList.length) {
  505. this.newCategoryId = newVal.semiProductList[0].categoryId;
  506. // this.formedNumLast = newVal.semiProductList.reduce((acc, pro) => {
  507. // return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
  508. // }, 0);
  509. this.formedNumLast = newVal.semiProductList.reduce((acc, pro) => {
  510. return pro.feedQuantity &&
  511. (!pro.extInfo.isQualified ||
  512. pro.extInfo.isQualified == 1 ||
  513. pro.extInfo.isQualified == 3) &&
  514. !pro.extInfo.isLoss
  515. ? this.add(acc, Number(pro.feedQuantity))
  516. : acc;
  517. }, 0);
  518. } else {
  519. this.formedNumLast = 0;
  520. }
  521. if (newVal.isUnpack == "1" && this.objData.singleReport == "1") {
  522. this.packageDispositionFn();
  523. }
  524. if (newVal.isNewUnpack == 1) {
  525. this.getPackingData();
  526. }
  527. // this.packageDispositionFn();
  528. //
  529. },
  530. deep: true,
  531. immediate: true,
  532. },
  533. },
  534. created() {
  535. // this.formedNumLast = this.objData.product[0].feedQuantity;
  536. console.log(this.objData, "我是阿打啥啊电话");
  537. this.byCode();
  538. // this.getPackingDetails()
  539. // this.getPackingDetailsTwo()
  540. },
  541. methods: {
  542. // 输入数量变化
  543. changeinput(e) {
  544. clearTimeout(this.timeout);
  545. // 设置新的定时器
  546. this.timeout = setTimeout(() => {
  547. this.formedNumLast = e.detail.value;
  548. this.initFn(this.selectList);
  549. }, 500); // 500毫秒后触发
  550. },
  551. changeUserType(e) {
  552. console.log(e);
  553. this.text = e.text;
  554. this.value = e.value;
  555. this.selectList = e.arr;
  556. this.initFn(e.arr);
  557. },
  558. changeUserTypeOne(e) {
  559. this.text = e.text;
  560. this.value = e.value;
  561. this.selectList = e.arr;
  562. this.initFn1(e.arr);
  563. },
  564. groupBy(arr, key) {
  565. return arr.reduce((acc, obj) => {
  566. const groupKey = obj[key];
  567. if (!acc[groupKey]) {
  568. acc[groupKey] = [];
  569. }
  570. console.log();
  571. acc[groupKey].push(obj);
  572. return acc;
  573. }, {});
  574. },
  575. async packageDispositionFn() {
  576. console.log(this.newCategoryId, "555555555555");
  577. let that = this;
  578. const res = await packageDisposition(this.newCategoryId);
  579. if (res.length) {
  580. res.shift();
  581. let data = JSON.parse(JSON.stringify(res));
  582. let list = this.groupBy(data, "code");
  583. this.localdataList = [];
  584. Object.entries(list).forEach(([key, value]) => {
  585. let obj = {
  586. text: value[0].name,
  587. arr: value,
  588. value: key,
  589. };
  590. this.localdataList.push(obj);
  591. });
  592. this.Usertype = this.localdataList[0].value;
  593. this.text = this.localdataList[0].text;
  594. this.value = this.localdataList[0].value;
  595. res.map((v) => {
  596. v.splitList = [];
  597. });
  598. // this.newDispositionList = res;
  599. if (this.warehouseId == 2) {
  600. this.newDispositionList = [res[0]];
  601. } else if (this.warehouseId == 3) {
  602. this.newDispositionList = [res[1]];
  603. } else if (this.warehouseId == 4) {
  604. this.newDispositionList = [res[2]];
  605. }
  606. this.selectList = res;
  607. this.warehouseSpecTypeList.forEach((item) => {
  608. if (item.value == 2) {
  609. item.textValue = item.text + `(${this.selectPackInfo(res[0])})`;
  610. }
  611. if (item.value == 3) {
  612. item.textValue = item.text + `(${this.selectPackInfo(res[1])})`;
  613. }
  614. if (item.value == 4) {
  615. item.textValue = item.text + `(${this.selectPackInfo(res[2])})`;
  616. }
  617. });
  618. this.initFn(this.localdataList[0].arr);
  619. // this.listFn(this.localdataList[0].arr);
  620. }
  621. },
  622. selectPackInfo(data) {
  623. const num = data.packageCell ? data.packageCell : "";
  624. const packageUnit = data.packageUnit ? data.packageUnit : "";
  625. const conversionUnit = data.conversionUnit ? data.conversionUnit : "";
  626. let packInfo = "";
  627. if (num) {
  628. packInfo = num + "/" + packageUnit + "/" + conversionUnit;
  629. }
  630. return packInfo;
  631. },
  632. initFn(v) {
  633. if (v.length) {
  634. this.withinQuantity = v[1].packageCell; //内包装数量
  635. this.withinUnit = v[1].conversionUnit; //内包装单位
  636. this.outsideQuantity = v[2].packageCell; //外包装数量
  637. this.outsideUnit = v[2].conversionUnit; //外包装单位
  638. this.minimumUnit = v[0].conversionUnit;
  639. }
  640. this.handleSplit(v[0]);
  641. },
  642. async listFn(res) {
  643. let {
  644. minimumPackage,
  645. withinQuantity,
  646. outsidePackage,
  647. outsideQuantity,
  648. withinPackage,
  649. } = res;
  650. // let textList = ["最小包装", "内包装", "外包装"];
  651. // let arr = [
  652. // { list: minimumPackage },
  653. // { list: withinPackage, num: withinQuantity },
  654. // { list: outsidePackage, num: outsideQuantity },
  655. // ];
  656. let textList = [];
  657. let arr = [];
  658. if (this.warehouseId == 2) {
  659. textList.push("最小包装");
  660. arr.push({ list: minimumPackage });
  661. } else if (this.warehouseId == 3) {
  662. textList.push("内包装");
  663. arr.push({ list: withinPackage, num: withinQuantity });
  664. } else if (this.warehouseId == 4) {
  665. textList.push("外包装");
  666. arr.push({ list: outsidePackage, num: outsideQuantity });
  667. }
  668. this.minimumPackage = minimumPackage; // 最小包装
  669. this.withinPackage = withinPackage; // 内包装
  670. this.outsidePackage = outsidePackage; //外包装
  671. // this.newDispositionList.map((v, i) => {
  672. // v.splitList = arr[i].list;
  673. // v.titel = textList[i];
  674. // if (i == 0) {
  675. // v.formedNumLast = this.formedNumLast;
  676. // } else {
  677. // v.formedNumLast = arr[i].num;
  678. // }
  679. // });
  680. this.newDispositionList.map((v, i) => {
  681. v.splitList = arr[0].list;
  682. v.titel = textList[0];
  683. if (i == 0) {
  684. v.formedNumLast = this.formedNumLast;
  685. } else {
  686. v.formedNumLast = arr.num;
  687. }
  688. });
  689. this.$nextTick(() => {
  690. console.log(this.DispositionList, "我是啥来着");
  691. this.$set(this, "DispositionList", this.newDispositionList);
  692. });
  693. },
  694. sunNum(v, i) {
  695. let _this = this;
  696. this.$nextTick(() => {
  697. switch (i) {
  698. case 0:
  699. console.log(_this.formedNumLast);
  700. return _this.formedNumLast;
  701. case 1:
  702. return v.splitList.length || 0;
  703. case 2:
  704. return v.splitList.length || 0;
  705. }
  706. });
  707. },
  708. byCode() {
  709. getByCode("packing_unit").then((res) => {
  710. this.unitList = [];
  711. res.forEach((obj, index) => {
  712. for (let key in obj) {
  713. if (obj.hasOwnProperty(key)) {
  714. // 确保key是对象自身的属性
  715. this.unitList.push({
  716. Key: `${key}`,
  717. Value: ` ${obj[key]}`,
  718. });
  719. }
  720. }
  721. });
  722. });
  723. },
  724. getPackingDetails() {
  725. let param = {
  726. workOrderId: this.workOrderId,
  727. taskId: this.taskId,
  728. tier: 1,
  729. };
  730. getPackingReport(param).then((res) => {
  731. this.splitList = res.detailList;
  732. this.formedNumLast = res.totalQuantity;
  733. this.quantity = res.quantity;
  734. this.unit = res.unit;
  735. });
  736. },
  737. handCancelPacking() {
  738. uni.showModal({
  739. title: `是否清空包装?`,
  740. content: "",
  741. confirmText: "确认",
  742. success: () => {
  743. let param = {
  744. workOrderId: this.workOrderId,
  745. taskId: this.taskId,
  746. };
  747. cancelPacking(param).then((res) => {
  748. this.getPackingDetails();
  749. this.getPackingDetailsTwo();
  750. });
  751. },
  752. });
  753. },
  754. // 第一次调用
  755. handleSplit(v) {
  756. if (this.splitList.length) {
  757. uni.showToast({
  758. title: "产品已分包",
  759. icon: "none",
  760. });
  761. return false;
  762. }
  763. // if (!this.formedNumLast) {
  764. // uni.showToast({
  765. // title: '包装总数数量不能为空',
  766. // icon: 'none'
  767. // })
  768. // return false
  769. // }
  770. if (!v.packageCell) {
  771. uni.showToast({
  772. title: "内包装单元数量不能为空",
  773. icon: "none",
  774. });
  775. return false;
  776. }
  777. if (!v.packageUnit) {
  778. uni.showToast({
  779. title: "请选择包装单位",
  780. icon: "none",
  781. });
  782. return false;
  783. }
  784. let param = {
  785. workOrderId: this.workOrderId, //工单id
  786. taskId: this.taskId,
  787. tier: this.warehouseId,
  788. totalQuantity: this.formedNumLast, //总数量
  789. quantity: v.packageCell, //数量
  790. unit: v.packageUnit, //单位
  791. minimumUnit: this.minimumUnit, //最小包装单位
  792. withinQuantity: this.withinQuantity, //内包装数量
  793. withinUnit: this.withinUnit, //内包装单位
  794. outsideQuantity: this.outsideQuantity, //外包装数量
  795. outsideUnit: this.outsideUnit, //外包装单位
  796. packageUnit: v.conversionUnit,
  797. };
  798. // packingReport(param).then((res) => {
  799. // this.listFn(res);
  800. // });
  801. if (this.warehouseId != 1) {
  802. getPackingList(param).then((res) => {
  803. this.listFn(res);
  804. });
  805. }
  806. // getPackingList(param).then((res) => {
  807. // this.listFn(res);
  808. // });
  809. },
  810. handleCheck(idx, it) {
  811. if (it.quantity <= 0) {
  812. uni.showToast({
  813. icon: "none",
  814. title: "数量为空不能勾选",
  815. });
  816. return false;
  817. }
  818. this.$set(this.splitList[idx], "check", it.check ? 0 : 1);
  819. this.temporaryList = [];
  820. this.temporaryList = this.splitList.filter((e) => {
  821. return e.check == 1;
  822. });
  823. this.temporaryNum = 0;
  824. this.temporaryCount = 0;
  825. if (this.temporaryList.length > 0) {
  826. this.temporaryList.forEach((e) => {
  827. this.temporaryNum = this.temporaryNum + 1;
  828. this.temporaryCount = this.temporaryCount + Number(e.quantity);
  829. });
  830. }
  831. },
  832. handclose(it) {
  833. this.splitList.forEach((f) => {
  834. if (f.computeSize == it.computeSize) {
  835. f.check = 0;
  836. }
  837. });
  838. this.temporaryList = [];
  839. this.temporaryList = this.splitList.filter((e) => {
  840. return e.check == 1;
  841. });
  842. },
  843. getPackingDetailsTwo(v) {
  844. console.log(v);
  845. let param = {
  846. totalQuantity: v.formedNumLast,
  847. quantity: v.packageCell,
  848. unit: v.conversionUnit,
  849. workOrderId: this.workOrderId,
  850. taskId: this.taskId,
  851. tier: 2,
  852. };
  853. getPackingReportRepeat(param).then((res) => {
  854. resolve(res.detailList);
  855. });
  856. },
  857. handlePack(v, s) {
  858. let _arr = [];
  859. _arr = s.map((m) => {
  860. return {
  861. ...m,
  862. isChecked: 1,
  863. };
  864. });
  865. console.log(_arr, "123");
  866. let param = {
  867. detailList: _arr,
  868. quantity: v.temporaryCount,
  869. totalQuantity: v.formedNumLast,
  870. unit: v.packageUnit,
  871. taskId: this.taskId,
  872. workOrderId: this.workOrderId,
  873. tier: 2,
  874. };
  875. return new Promise((resolve, reject) => {
  876. packingReportRepeat(param).then((res) => {
  877. console.log(res);
  878. // this.temporaryList = []
  879. this.getPackingDetails();
  880. // this.getPackingDetailsTwo()
  881. });
  882. });
  883. },
  884. scrolltolower() {},
  885. getData() {
  886. let _packingReportMarginList = [];
  887. _packingReportMarginList = this.splitList.filter((e) => {
  888. return !e.parentId;
  889. });
  890. let packInfo = {};
  891. if (this.isNewUnpack == 1) {
  892. if (this.DispositionList && this.DispositionList.length != 0) {
  893. packInfo = {
  894. // this.DispositionList[0]
  895. specText: this.text,
  896. specValue: this.value,
  897. minimumPackage: this.minimumPackage, // 最小包装
  898. withinPackage: this.withinPackage,
  899. outsidePackage: this.outsidePackage,
  900. tier: this.warehouseId,
  901. isUnpack: this.objData.isUnpack,
  902. packageUnit: this.packageUnit,
  903. formedNumLast: this.formedNumLast,
  904. minimumPackageCell: this.DispositionList[0].packageCell, // 最小包装
  905. minimumPackageUnit: this.DispositionList[0].packageUnit, // 最小包装单位
  906. minimumConversionUnit: this.DispositionList[0].conversionUnit, // 最小包装单位
  907. minimumFormedNumLast: this.DispositionList[0].formedNumLast, // 总包装数量
  908. withinPackageCell: this.DispositionList[1].packageCell, // 最小包装名称
  909. withinPackageUnit: this.DispositionList[1].packageUnit, // 最小包装单位
  910. withinConversionUnit: this.DispositionList[1].conversionUnit, // 最小包装单位
  911. withinFormedNumLast: this.DispositionList[1].formedNumLast, // 总包装数量
  912. outsidePackageCell: this.DispositionList[2].packageCell, // 最小包装名称
  913. outsidePackageUnit: this.DispositionList[2].packageUnit, // 最小包装单位
  914. outsideConversionUnit: this.DispositionList[2].conversionUnit, // 最小包装单位
  915. outsideFormedNumLast: this.DispositionList[2].formedNumLast,
  916. isNewUnpack: this.isNewUnpack,
  917. };
  918. } else {
  919. packInfo = {
  920. isUnpack: this.objData.isUnpack,
  921. };
  922. }
  923. } else {
  924. if (this.warehouseId == 2) {
  925. if (this.DispositionList && this.DispositionList.length != 0) {
  926. packInfo = {
  927. // this.DispositionList[0]
  928. specText: this.text,
  929. specValue: this.value,
  930. minimumPackage: this.minimumPackage, // 最小包装
  931. tier: this.warehouseId,
  932. isUnpack: this.objData.isUnpack,
  933. packUnitInfo: this.warehouseSpecTypeList[1].textValue,
  934. minimumPackageCell: this.DispositionList[0].packageCell, // 最小包装
  935. minimumPackageUnit: this.DispositionList[0].packageUnit, // 最小包装单位
  936. minimumConversionUnit: this.DispositionList[0].conversionUnit, // 最小包装单位
  937. minimumFormedNumLast: this.DispositionList[0].formedNumLast, // 总包装数量
  938. isNewUnpack: this.isNewUnpack,
  939. };
  940. } else {
  941. packInfo = {
  942. tier: 1,
  943. isUnpack: this.objData.isUnpack,
  944. };
  945. }
  946. } else if (this.warehouseId == 3) {
  947. if (this.DispositionList && this.DispositionList.length != 0) {
  948. packInfo = {
  949. specText: this.text,
  950. specValue: this.value,
  951. withinPackage: this.withinPackage, // 内包装
  952. tier: this.warehouseId,
  953. isUnpack: this.objData.isUnpack,
  954. packUnitInfo: this.warehouseSpecTypeList[2].textValue,
  955. withinPackageCell: this.DispositionList[1].packageCell, // 最小包装名称
  956. withinPackageUnit: this.DispositionList[1].packageUnit, // 最小包装单位
  957. withinConversionUnit: this.DispositionList[1].conversionUnit, // 最小包装单位
  958. withinFormedNumLast: this.DispositionList[1].formedNumLast,
  959. isNewUnpack: this.isNewUnpack,
  960. }; // 总包装数量
  961. } else {
  962. packInfo = {
  963. tier: 3,
  964. isUnpack: this.objData.isUnpack,
  965. };
  966. }
  967. } else if (this.warehouseId == 4) {
  968. if (this.DispositionList && this.DispositionList.length != 0) {
  969. packInfo = {
  970. specText: this.text,
  971. specValue: this.value,
  972. outsidePackage: this.outsidePackage, //外包装
  973. tier: this.warehouseId,
  974. isUnpack: this.objData.isUnpack,
  975. packUnitInfo: this.warehouseSpecTypeList[3].textValue,
  976. outsidePackageCell: this.DispositionList[2].packageCell, // 最小包装名称
  977. outsidePackageUnit: this.DispositionList[2].packageUnit, // 最小包装单位
  978. outsideConversionUnit: this.DispositionList[2].conversionUnit, // 最小包装单位
  979. outsideFormedNumLast: this.DispositionList[2].formedNumLast,
  980. isNewUnpack: this.isNewUnpack,
  981. }; // 总包装数量
  982. } else {
  983. packInfo = {
  984. tier: 4,
  985. isUnpack: this.objData.isUnpack,
  986. };
  987. }
  988. }
  989. }
  990. return packInfo;
  991. },
  992. calculation() {
  993. this.show = true;
  994. },
  995. calculationSave() {
  996. let count = this.splitList.filter((item) => item.isChecked != 1).length;
  997. if (this.formData.wPackNum <= count && count != 0) {
  998. for (let i = 0; i < this.formData.wPackNum; i++) {
  999. this.splitList[i].check = 1;
  1000. }
  1001. this.handleCheck(0, 0);
  1002. this.calculationClose();
  1003. } else {
  1004. if (count != 0) {
  1005. for (let i = 0; i < count; i++) {
  1006. this.splitList[i].check = 1;
  1007. }
  1008. this.handleCheck(0, 0);
  1009. this.calculationClose();
  1010. }
  1011. uni.showToast({
  1012. icon: "none",
  1013. title: "外包装数超出内包装条数",
  1014. });
  1015. }
  1016. },
  1017. calculationClose() {
  1018. this.show = false;
  1019. },
  1020. calculationReset() {
  1021. this.formData.wPackNum = null;
  1022. this.splitList.forEach((f) => {
  1023. f.check = null;
  1024. });
  1025. this.temporaryList = [];
  1026. this.show = false;
  1027. },
  1028. changeWarehouseType() {
  1029. this.packageDispositionFn();
  1030. },
  1031. checkUnpack() {
  1032. this.$refs.alertDialog.open();
  1033. },
  1034. dialogConfirm() {
  1035. this.isNewUnpack = 1;
  1036. this.getPackingData();
  1037. },
  1038. async getPackingData() {
  1039. console.log(this.newCategoryId, "555555555555");
  1040. let that = this;
  1041. const res = await packageDisposition(this.newCategoryId);
  1042. if (res.length) {
  1043. res.shift();
  1044. let data = JSON.parse(JSON.stringify(res));
  1045. let list = this.groupBy(data, "code");
  1046. this.localdataList = [];
  1047. Object.entries(list).forEach(([key, value]) => {
  1048. let obj = {
  1049. text: value[0].name,
  1050. arr: value,
  1051. value: key,
  1052. };
  1053. this.localdataList.push(obj);
  1054. });
  1055. this.Usertype = this.localdataList[0].value;
  1056. this.text = this.localdataList[0].text;
  1057. this.value = this.localdataList[0].value;
  1058. res.map((v) => {
  1059. v.splitList = [];
  1060. });
  1061. // this.newDispositionList = res;
  1062. this.DispositionListes = res;
  1063. this.selectList = res;
  1064. this.initFn1(this.localdataList[0].arr);
  1065. }
  1066. },
  1067. initFn1(v) {
  1068. if (v.length) {
  1069. this.withinQuantity = v[1].packageCell; //内包装数量
  1070. this.withinUnit = v[1].conversionUnit; //内包装单位
  1071. this.outsideQuantity = v[2].packageCell; //外包装数量
  1072. this.outsideUnit = v[2].conversionUnit; //外包装单位
  1073. this.minimumUnit = v[0].conversionUnit;
  1074. }
  1075. this.handleSplit1(v[0]);
  1076. },
  1077. handleSplit1(v) {
  1078. if (this.splitList.length) {
  1079. uni.showToast({
  1080. title: "产品已分包",
  1081. icon: "none",
  1082. });
  1083. return false;
  1084. }
  1085. if (!v.packageCell) {
  1086. uni.showToast({
  1087. title: "内包装单元数量不能为空",
  1088. icon: "none",
  1089. });
  1090. return false;
  1091. }
  1092. if (!v.packageUnit) {
  1093. uni.showToast({
  1094. title: "请选择包装单位",
  1095. icon: "none",
  1096. });
  1097. return false;
  1098. }
  1099. this.packageCell = this.formedNumLast;
  1100. this.packageUnit = v.packageUnit;
  1101. let param = {
  1102. workOrderId: this.workOrderId, //工单id
  1103. taskId: this.taskId,
  1104. tier: this.warehouseId,
  1105. totalQuantity: this.formedNumLast, //总数量
  1106. quantity: v.packageCell, //数量
  1107. unit: v.packageUnit, //单位
  1108. minimumUnit: this.minimumUnit, //最小包装单位
  1109. withinQuantity: this.withinQuantity, //内包装数量
  1110. withinUnit: this.withinUnit, //内包装单位
  1111. outsideQuantity: this.outsideQuantity, //外包装数量
  1112. outsideUnit: this.outsideUnit, //外包装单位
  1113. packageUnit: v.conversionUnit,
  1114. isNewUnpack: this.isNewUnpack,
  1115. };
  1116. if (this.warehouseId != 1) {
  1117. getPackingList(param).then((res) => {
  1118. this.listFn1(res);
  1119. });
  1120. }
  1121. },
  1122. toInteger(num) {
  1123. const len = this.getDecimalLength(num);
  1124. return {
  1125. int: Math.round(num * Math.pow(10, len)),
  1126. factor: Math.pow(10, len),
  1127. };
  1128. },
  1129. add(a, b) {
  1130. const { int: aInt, factor: aFactor } = this.toInteger(a);
  1131. const { int: bInt, factor: bFactor } = this.toInteger(b);
  1132. const maxFactor = Math.max(aFactor, bFactor);
  1133. return (
  1134. (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
  1135. maxFactor
  1136. );
  1137. },
  1138. sub(a, b) {
  1139. const { int: aInt, factor: aFactor } = this.toInteger(a);
  1140. const { int: bInt, factor: bFactor } = this.toInteger(b);
  1141. const maxFactor = Math.max(aFactor, bFactor);
  1142. return (
  1143. (aInt * (maxFactor / aFactor) - bInt * (maxFactor / bFactor)) /
  1144. maxFactor
  1145. );
  1146. },
  1147. getDecimalLength(num) {
  1148. return (num.toString().split(".")[1] || "").length;
  1149. },
  1150. async listFn1(res) {
  1151. let {
  1152. minimumPackage,
  1153. withinQuantity,
  1154. outsidePackage,
  1155. outsideQuantity,
  1156. withinPackage,
  1157. minimumQuantity,
  1158. } = res;
  1159. let textList = ["最小包装", "内包装", "外包装"];
  1160. let arr = [
  1161. { list: minimumPackage, num: minimumQuantity },
  1162. { list: withinPackage, num: withinQuantity },
  1163. { list: outsidePackage, num: outsideQuantity },
  1164. ];
  1165. this.minimumPackage = minimumPackage; // 最小包装
  1166. this.withinPackage = withinPackage; // 内包装
  1167. this.outsidePackage = outsidePackage; //外包装
  1168. this.newDispositionList = this.DispositionListes.filter(
  1169. (it) => it.code == this.Usertype && it.sort != "0"
  1170. );
  1171. this.newDispositionList.map((v, i) => {
  1172. v.splitList = arr[i].list;
  1173. v.titel = textList[i];
  1174. // if (i == 0) {
  1175. // v.formedNumLast = this.formedNumLast;
  1176. // } else {
  1177. v.formedNumLast = arr[i].num;
  1178. // }
  1179. });
  1180. this.$nextTick(() => {
  1181. this.newDispositionList.forEach((item, index) => {
  1182. if (index == 0) {
  1183. this.packageCell = item.formedNumLast ? item.formedNumLast : "";
  1184. this.packageUnit = item.packageUnit ? item.packageUnit : "";
  1185. this.conversionUnit = item.conversionUnit
  1186. ? item.conversionUnit
  1187. : "";
  1188. } else if (index == 1) {
  1189. this.packageOneCell = item.formedNumLast ? item.formedNumLast : "";
  1190. this.packageOneUnit = item.packageUnit ? item.packageUnit : "";
  1191. this.conversionOneUnit = item.conversionUnit
  1192. ? item.conversionUnit
  1193. : "";
  1194. } else if (index == 2) {
  1195. this.packageTwoCell = item.formedNumLast ? item.formedNumLast : "";
  1196. this.packageTwoUnit = item.packageUnit ? item.packageUnit : "";
  1197. this.conversionTwoUnit = item.conversionUnit
  1198. ? item.conversionUnit
  1199. : "";
  1200. }
  1201. });
  1202. this.packageDispositionData = `${this.formedNumLast}${this.packageUnit}/${this.packageCell}${this.conversionUnit}/${this.packageOneCell}${this.conversionOneUnit}/${this.packageTwoCell}${this.conversionTwoUnit}`;
  1203. this.newDispositionList.forEach((item, index) => {
  1204. if (item.splitList.length != 0) {
  1205. item.splitList[0].extInfo.packageDisposition =
  1206. this.packageDispositionData;
  1207. if (index == 0) {
  1208. this.warehouseId = 2;
  1209. } else if (index == 1) {
  1210. this.warehouseId = 3;
  1211. } else if (index == 2) {
  1212. this.warehouseId = 4;
  1213. }
  1214. }
  1215. });
  1216. this.$set(this, "DispositionList", this.newDispositionList);
  1217. this.$forceUpdate();
  1218. });
  1219. },
  1220. changeInputPack(item, index) {
  1221. setTimeout(() => {
  1222. if (this.DispositionList[index]) {
  1223. if (!this.DispositionList[index].packageCell) {
  1224. if (index <= this.DispositionList.length - 1) {
  1225. this.DispositionList[index].formedNumLast = "";
  1226. if (index + 1 <= this.DispositionList.length - 1) {
  1227. this.DispositionList[index + 1].formedNumLast = "";
  1228. }
  1229. if (index + 2 <= this.DispositionList.length - 1) {
  1230. this.DispositionList[index + 2].formedNumLast = "";
  1231. }
  1232. }
  1233. this.newDispositionList.forEach((item, index) => {
  1234. if (index == 0) {
  1235. this.packageCell = item.formedNumLast ? item.formedNumLast : "";
  1236. this.packageUnit = item.packageUnit ? item.packageUnit : "";
  1237. this.conversionUnit = item.conversionUnit
  1238. ? item.conversionUnit
  1239. : "";
  1240. } else if (index == 1) {
  1241. this.packageOneCell = item.formedNumLast
  1242. ? item.formedNumLast
  1243. : "";
  1244. this.packageOneUnit = item.packageUnit ? item.packageUnit : "";
  1245. this.conversionOneUnit = item.conversionUnit
  1246. ? item.conversionUnit
  1247. : "";
  1248. } else if (index == 2) {
  1249. this.packageTwoCell = item.formedNumLast
  1250. ? item.formedNumLast
  1251. : "";
  1252. this.packageTwoUnit = item.packageUnit ? item.packageUnit : "";
  1253. this.conversionTwoUnit = item.conversionUnit
  1254. ? item.conversionUnit
  1255. : "";
  1256. }
  1257. });
  1258. this.packageDispositionData = `${this.formedNumLast}${this.packageUnit}/${this.packageCell}${this.conversionUnit}/${this.packageOneCell}${this.conversionOneUnit}/${this.packageTwoCell}${this.conversionTwoUnit}`;
  1259. this.DispositionList.forEach((item, index) => {
  1260. if (item.splitList.length != 0) {
  1261. this.DispositionList[
  1262. index
  1263. ].splitList[0].extInfo.packageDisposition =
  1264. this.packageDispositionData;
  1265. }
  1266. });
  1267. this.$forceUpdate();
  1268. return;
  1269. }
  1270. }
  1271. if (this.DispositionList[index]) {
  1272. if (this.DispositionList[index].titel == "最小包装") {
  1273. if (
  1274. this.DispositionList[index].formedNumLast &&
  1275. Number(this.DispositionList[index].packageCell) >
  1276. Number(this.formedNumLast)
  1277. ) {
  1278. this.DispositionList[index].packageCell = Number(
  1279. this.formedNumLast
  1280. );
  1281. }
  1282. } else if (this.DispositionList[index].titel == "内包装") {
  1283. if (
  1284. this.DispositionList[index - 1].formedNumLast &&
  1285. Number(this.DispositionList[index].packageCell) >
  1286. Number(this.DispositionList[index - 1].formedNumLast)
  1287. ) {
  1288. this.DispositionList[index].packageCell = Number(
  1289. this.DispositionList[index - 1].formedNumLast
  1290. );
  1291. }
  1292. } else if (this.DispositionList[index].titel == "外包装") {
  1293. if (
  1294. this.DispositionList[index - 1].formedNumLast &&
  1295. Number(this.DispositionList[index].packageCell) >
  1296. Number(this.DispositionList[index - 1].formedNumLast)
  1297. ) {
  1298. this.DispositionList[index].packageCell = Number(
  1299. this.DispositionList[index - 1].formedNumLast
  1300. );
  1301. }
  1302. }
  1303. }
  1304. console.log(this.DispositionList, "返回的数据");
  1305. this.initFn1(this.DispositionList);
  1306. }, 500);
  1307. },
  1308. dialogClose() {
  1309. console.log("窗口关闭了");
  1310. },
  1311. deepCopy(obj, hash = new WeakMap()) {
  1312. if (obj === null) return null;
  1313. if (obj instanceof Date) return new Date(obj);
  1314. if (obj instanceof RegExp) return new RegExp(obj);
  1315. if (typeof obj !== "object" && typeof obj !== "function") return obj;
  1316. if (hash.has(obj)) return hash.get(obj); // 处理循环引用
  1317. const result = Array.isArray(obj) ? [] : {};
  1318. hash.set(obj, result); // 存储原始对象和其副本的映射关系
  1319. return Object.keys(obj).reduce((acc, key) => {
  1320. acc[key] = this.deepCopy(obj[key], hash);
  1321. return acc;
  1322. }, result);
  1323. },
  1324. },
  1325. };
  1326. </script>
  1327. <style lang="scss" scoped>
  1328. .title_box {
  1329. margin-top: 20rpx;
  1330. .ww20 {
  1331. width: 20%;
  1332. }
  1333. .name {
  1334. font-size: 28rpx;
  1335. font-style: normal;
  1336. font-weight: 400;
  1337. color: $theme-color;
  1338. padding-left: 20rpx;
  1339. position: relative;
  1340. &:before {
  1341. position: absolute;
  1342. content: "";
  1343. left: 0rpx;
  1344. top: 0rpx;
  1345. bottom: 0rpx;
  1346. width: 4rpx;
  1347. height: 28rpx;
  1348. background: $theme-color;
  1349. margin: auto;
  1350. }
  1351. }
  1352. .btn_box {
  1353. color: $theme-color;
  1354. }
  1355. }
  1356. .material {
  1357. margin-top: 10rpx;
  1358. .content_table {
  1359. width: 100%;
  1360. border: 2rpx solid $border-color;
  1361. .item {
  1362. display: flex;
  1363. border-bottom: 2rpx solid $border-color;
  1364. .lable {
  1365. width: 132rpx;
  1366. text-align: center;
  1367. background-color: #f7f9fa;
  1368. font-size: 26rpx;
  1369. border-right: 2rpx solid $border-color;
  1370. flex-shrink: 0;
  1371. }
  1372. .lable220 {
  1373. width: 220rpx !important;
  1374. font-size: 24rpx;
  1375. }
  1376. .lable150 {
  1377. width: 156rpx !important;
  1378. font-size: 24rpx;
  1379. }
  1380. .ww80 {
  1381. width: 80rpx;
  1382. }
  1383. .content {
  1384. width: 518rpx;
  1385. min-height: 64rpx;
  1386. font-size: 28rpx;
  1387. line-height: 28rpx;
  1388. font-style: normal;
  1389. font-weight: 400;
  1390. // padding: 18rpx 8rpx;
  1391. box-sizing: border-box;
  1392. word-wrap: break-word;
  1393. flex-grow: 1 !important;
  1394. .unit {
  1395. padding: 0 4rpx;
  1396. font-size: 24rpx;
  1397. color: #404446;
  1398. }
  1399. }
  1400. &:last-child {
  1401. border-bottom: none;
  1402. }
  1403. }
  1404. .ww55 {
  1405. width: 55%;
  1406. }
  1407. .ww45 {
  1408. width: 45%;
  1409. }
  1410. }
  1411. }
  1412. .content_table2 {
  1413. width: 100%;
  1414. margin-top: 16rpx;
  1415. .row {
  1416. width: 100%;
  1417. .item {
  1418. color: #404446;
  1419. font-size: 28rpx;
  1420. padding-left: 12rpx;
  1421. }
  1422. .color157 {
  1423. color: $theme-color;
  1424. }
  1425. .ww30 {
  1426. width: 30%;
  1427. }
  1428. .ww50 {
  1429. width: 50%;
  1430. }
  1431. .ww90 {
  1432. width: 90%;
  1433. }
  1434. .ww15 {
  1435. width: 15%;
  1436. }
  1437. .ww10 {
  1438. width: 10%;
  1439. }
  1440. .ww30 {
  1441. width: 30%;
  1442. }
  1443. .ww20 {
  1444. width: 20%;
  1445. }
  1446. .ww40 {
  1447. width: 40%;
  1448. }
  1449. .jsColor {
  1450. color: $theme-color;
  1451. font-size: 20rpx;
  1452. }
  1453. }
  1454. .head {
  1455. height: 64rpx;
  1456. background: #f7f9fa;
  1457. border-top: 2rpx solid #e3e5e5;
  1458. border-left: 2rpx solid #e3e5e5;
  1459. .item {
  1460. height: 64rpx;
  1461. line-height: 64rpx;
  1462. border-right: 2rpx solid #e3e5e5;
  1463. box-sizing: border-box;
  1464. }
  1465. }
  1466. .tr {
  1467. border-top: 2rpx solid #e3e5e5;
  1468. border-left: 2rpx solid #e3e5e5;
  1469. .item {
  1470. font-size: 24rpx;
  1471. min-height: 64rpx;
  1472. display: flex;
  1473. align-items: center;
  1474. border-right: 2rpx solid #e3e5e5;
  1475. box-sizing: border-box;
  1476. white-space: normal;
  1477. word-break: break-all;
  1478. }
  1479. &:last-child {
  1480. border-bottom: 2rpx solid #e3e5e5;
  1481. }
  1482. }
  1483. }
  1484. .label {
  1485. display: flex;
  1486. height: 70rpx;
  1487. width: 86px !important;
  1488. font-size: 13px;
  1489. align-items: center;
  1490. justify-content: center;
  1491. background-color: #f7f9fa;
  1492. }
  1493. .content_num {
  1494. display: flex;
  1495. align-items: center;
  1496. padding: 0 4rpx;
  1497. /deep/ .uni-input-input {
  1498. border: 2rpx solid #f0f8f2;
  1499. background: #f0f8f2;
  1500. color: $theme-color;
  1501. }
  1502. }
  1503. .penalize {
  1504. width: 86rpx;
  1505. line-height: 60rpx;
  1506. background: $theme-color;
  1507. font-size: 24rpx;
  1508. text-align: center;
  1509. color: #fff;
  1510. }
  1511. .check {
  1512. width: 30rpx;
  1513. height: 30rpx;
  1514. }
  1515. .z_list {
  1516. max-height: 500rpx;
  1517. }
  1518. .search_list {
  1519. min-height: 100rpx;
  1520. width: 80vw;
  1521. /deep/ .baseForm {
  1522. padding: 0 20rpx;
  1523. }
  1524. }
  1525. .operate_box {
  1526. padding: 10rpx 32rpx;
  1527. /deep/ .u-button {
  1528. width: 30%;
  1529. }
  1530. }
  1531. </style>