outsourceList.vue 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. <template>
  2. <!-- 委外下一步 -->
  3. <div class="card">
  4. <div class="c_header_title">
  5. <div class="c_title">委外记录</div>
  6. </div>
  7. <div class="card_box">
  8. <el-descriptions>
  9. <el-descriptions-item label="委外名称">{{
  10. outObj.name
  11. }}</el-descriptions-item>
  12. <el-descriptions-item label="委外类型">{{
  13. outObj.type == 4 ? '带料委外' : '不带料委外'
  14. }}</el-descriptions-item>
  15. <!-- <el-descriptions-item label="直接入库">{{ outObj.isInWarehouse == 1 ? '是' : '否' }}</el-descriptions-item> -->
  16. <el-descriptions-item label="直接入库">{{ '是' }}</el-descriptions-item>
  17. </el-descriptions>
  18. </div>
  19. <el-tabs v-model="activeName">
  20. <el-tab-pane label="物品清单" name="0">
  21. <div class="materialList">
  22. <div class="u-reset">
  23. <el-button
  24. type="primary"
  25. size="small"
  26. class="u-reset-button"
  27. @click="openPicking(2, 'goods')"
  28. >
  29. 添加
  30. </el-button>
  31. </div>
  32. <!-- <div class="u-reset" style="display: flex;" v-if="clientEnvironmentId != 2">
  33. <el-checkbox color="#fff" v-model="checkedAll" :checked="seletedAll" @change="_seletedAll">全选
  34. </el-checkbox>
  35. <div class="gxList">勾选:<span style="color: #157A2C">{{ checkListLen || 0 }}个</span></div>
  36. </div>
  37. <div v-for="(item, index) in pickOutInList" :key="index">
  38. <div class="listBox rx-bs">
  39. <div class="listBox-sel">
  40. <el-checkbox v-model="item.checked" color="#fff"
  41. @change="e => selectVal(e, item, index)"
  42. v-if='(item.rootCategoryLevelId != 11 || (item.rootCategoryLevelId == 11 && item.status != 1)) && clientEnvironmentId != 2'
  43. >
  44. </el-checkbox>
  45. </div>
  46. <div class="listBox-con">
  47. <div class="listBox-top rx-bc">
  48. <div> {{ item.name }}</div>
  49. <div class="code">
  50. {{ item.rootCategoryLevelId == 4 ? item.codeNumber : item.code }}
  51. </div>
  52. </div>
  53. <div class="listBox-bottom rx">
  54. <div v-for="(itm, index) in tableH(item.rootCategoryLevelId)" :key="index"
  55. class="items" v-if="!itm.formatter">
  56. <span>{{ itm.label }}</span>{{ item[itm.prop] }}
  57. </div>
  58. <div class="items"
  59. v-if='(item.rootCategoryLevelId == 1 && item.isConsumable == 1) && item.rootCategoryLevelId != 11 && item.rootCategoryLevelId != 4'>
  60. <span>可用库存:</span>{{ item.availableCountBase }} {{ item.unit }}
  61. </div>
  62. <div class="items"
  63. v-if='([1, 2, 9, 23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 0)'>
  64. <span>刻码:</span>{{ item.extInfo.engrave }}
  65. </div>
  66. <div class="items"
  67. v-if='([1, 2, 9, 23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 0)'>
  68. <span>物料代号:</span>{{ item.extInfo.materielCode }}
  69. </div>
  70. <div class="items"
  71. v-if='([1, 2, 9, 23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 0)'>
  72. <span>客户代号:</span>{{ item.extInfo.clientCode }}
  73. </div>
  74. <div class="items" style="width: 15%;"
  75. v-if='([1, 2, 9, 23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 0)'>
  76. <span>重量:</span>{{ item.extInfo.newWeight }} {{ item.extInfo.weightUnit }}
  77. </div>
  78. <div class="items" style="width: 15%;"
  79. v-if='([1, 2, 9, 23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 1)'>
  80. <span>数量:</span>{{ item.feedQuantity }}
  81. </div>
  82. <div class="items" style="width: 15%;"
  83. v-if='([1, 2, 9, 23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 1)'>
  84. <span>重量:</span>{{ item.weight || 0 }} {{ item.weightUnit }}
  85. </div>
  86. <div class="items"
  87. v-if='([1, 2, 9, 23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 1)'>
  88. <span>规格:</span> {{ item.specification }}
  89. </div>
  90. <div class="items"
  91. v-if='([1, 2, 9, 23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 1)'>
  92. <span>型号:</span> {{ item.modelType }}
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div> -->
  98. <el-table
  99. ref="pickOutRef"
  100. class="table_content"
  101. :max-height="600"
  102. :data="pickOutInList"
  103. tooltip-effect="dark"
  104. style="width: 100%; margin-top: 10px"
  105. stripe
  106. border
  107. @selection-change="selectionPickOut"
  108. >
  109. <el-table-column align="center" type="selection" width="55">
  110. </el-table-column>
  111. <el-table-column label="序号" type="index" width="55">
  112. <template slot-scope="{ row, $index }">
  113. {{ $index + 1 }}
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. label="编码"
  118. type="code"
  119. minWidth="110"
  120. show-overflow-tooltip
  121. >
  122. <template slot-scope="{ row, $index }">
  123. {{ row.categoryCode }}
  124. </template>
  125. </el-table-column>
  126. <el-table-column
  127. label="名称"
  128. type="name"
  129. minWidth="110"
  130. show-overflow-tooltip
  131. >
  132. <template slot-scope="{ row, $index }">
  133. {{ row.name }}
  134. <!-- ({{
  135. row.rootCategoryLevelId == 2
  136. ? '在制品'
  137. : row.rootCategoryLevelId == 23
  138. ? '半成品'
  139. : row.rootCategoryLevelId == 9
  140. ? '产品'
  141. : item.rootCategoryLevelId == 28
  142. ? '废品'
  143. : ''
  144. }}) -->
  145. </template>
  146. </el-table-column>
  147. <el-table-column
  148. label="型号"
  149. type="modelType"
  150. show-overflow-tooltip
  151. >
  152. <template slot-scope="{ row, $index }">
  153. {{ row.modelType }}
  154. </template>
  155. </el-table-column>
  156. <el-table-column
  157. label="规格"
  158. type="specification"
  159. show-overflow-tooltip
  160. >
  161. <template slot-scope="{ row, $index }">
  162. {{ row.specification }}
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="牌号" type="brandNum" show-overflow-tooltip>
  166. <template slot-scope="{ row, $index }">
  167. {{ row.brandNum }}
  168. </template>
  169. </el-table-column>
  170. <el-table-column
  171. label="数量"
  172. type="feedQuantity"
  173. show-overflow-tooltip
  174. >
  175. <template slot-scope="{ row, $index }">
  176. <el-input
  177. v-model="row.feedQuantity"
  178. v-if="row.isSelection == '1'"
  179. @input="inputNum(row, $index)"
  180. ></el-input>
  181. <span v-else> {{ row.feedQuantity }}</span>
  182. </template>
  183. <!-- <template slot-scope="{ row, $index }" v-else>
  184. {{ row.feedQuantity }}
  185. </template> -->
  186. </el-table-column>
  187. <el-table-column
  188. label="重量"
  189. type="weightUnit"
  190. width="120"
  191. show-overflow-tooltip
  192. >
  193. <template slot-scope="{ row, $index }">
  194. {{ row.newWeight || 0 }} {{ row.weightUnit }}
  195. </template>
  196. </el-table-column>
  197. <el-table-column label="刻码" type="engrave" show-overflow-tooltip>
  198. <template slot-scope="{ row, $index }">
  199. {{ row.extInfo.engrave }}
  200. </template>
  201. </el-table-column>
  202. <el-table-column
  203. label="物料代号"
  204. type="materielCode"
  205. show-overflow-tooltip
  206. >
  207. <template slot-scope="{ row, $index }">
  208. {{ row.extInfo.materielCode }}
  209. </template>
  210. </el-table-column>
  211. <el-table-column
  212. label="客户代号"
  213. type="clientCode"
  214. show-overflow-tooltip
  215. >
  216. <template slot-scope="{ row, $index }">
  217. {{ row.extInfo.clientCode }}
  218. </template>
  219. </el-table-column>
  220. <el-table-column label="操作" show-overflow-tooltip fixed="right">
  221. <template slot-scope="{ row, $index }">
  222. <el-button type="text" @click="deleteData(row, $index)"
  223. >删除</el-button
  224. >
  225. </template>
  226. </el-table-column>
  227. </el-table>
  228. </div>
  229. </el-tab-pane>
  230. <el-tab-pane label="带料清单" name="1">
  231. <div class="materialList">
  232. <div class="u-reset">
  233. <el-button
  234. type="primary"
  235. size="small"
  236. class="u-reset-button"
  237. @click="openPicking(2, 'belting')"
  238. >
  239. 添加
  240. </el-button>
  241. </div>
  242. <div v-for="(item, index) in bomMaterialList" :key="index">
  243. <label class="listBox rx-bs">
  244. <div class="listBox-con">
  245. <div class="listBox-bottom rx">
  246. <div class="items"> <span>序号</span>{{ index + 1 }} </div>
  247. <div class="items" :title="item.name">
  248. <span>名称</span>{{ item.name }}
  249. </div>
  250. <div class="items" :title="item.code">
  251. <span>编码</span>{{ item.code }}
  252. </div>
  253. <div
  254. v-for="(itm, index) in tableH(item.rootCategoryLevelId)"
  255. :key="index"
  256. class="items"
  257. v-if="!itm.formatter"
  258. >
  259. <span>{{ itm.label }}</span
  260. >{{ item[itm.prop] }}
  261. </div>
  262. <div
  263. class="items"
  264. v-if="item.isDemandQuantity && clientEnvironmentId != 2"
  265. style="width: 15%"
  266. >
  267. <span>数量</span
  268. >{{
  269. checkListLen == 0
  270. ? item.demandQuantity
  271. : item.count * (checkListLen || 1)
  272. }}
  273. {{ item.unit }}
  274. </div>
  275. <div
  276. class="items content_num"
  277. v-if="!item.isDemandQuantity && clientEnvironmentId != 2"
  278. style="width: 15%"
  279. >
  280. <span>数量</span>
  281. <input
  282. style="width: 90% !important"
  283. v-model="item.demandQuantity"
  284. />
  285. {{ item.measuringUnit }}
  286. </div>
  287. <div
  288. class="items"
  289. v-if="item.isDemandQuantity && clientEnvironmentId == 2"
  290. style="width: 15%"
  291. >
  292. <span>数量</span
  293. >{{ item.count * (outObj.formedNumLast || 1) }}
  294. </div>
  295. <div
  296. class="items content_num"
  297. v-if="!item.isDemandQuantity && clientEnvironmentId == 2"
  298. style="width: 15%"
  299. >
  300. <span>数量</span>
  301. <input
  302. style="width: 90% !important"
  303. v-model="item.demandQuantity"
  304. />
  305. {{ item.measuringUnit }}
  306. </div>
  307. <div>
  308. <el-button type="text" @click="convertList(item, index)"
  309. >转物品清单</el-button
  310. >
  311. <el-button
  312. type="text"
  313. style="color: red"
  314. @click="deleteBomMaterial(item, index)"
  315. >删除</el-button
  316. >
  317. </div>
  318. </div>
  319. </div>
  320. </label>
  321. </div>
  322. </div>
  323. </el-tab-pane>
  324. <el-tab-pane label="产出清单" name="2">
  325. <div class="materialList">
  326. <div class="u-reset">
  327. <!-- <el-button
  328. type="primary"
  329. size="small"
  330. class="u-reset-button"
  331. @click="openPicking(3, 'output')"
  332. >
  333. 添加
  334. </el-button> -->
  335. </div>
  336. <div v-for="(item, index) in standardOutputList" :key="index">
  337. <label class="listBox rx-bs">
  338. <div class="listBox-con">
  339. <div class="listBox-bottom rx">
  340. <div class="items" style="width: 15%">
  341. <span>序号</span>{{ index + 1 }}
  342. </div>
  343. <div class="items"> <span>名称</span>{{ item.name }} </div>
  344. <div class="items"> <span>编码</span>{{ item.code }} </div>
  345. <div
  346. v-for="(itm, index) in tableH(item.rootCategoryLevelId)"
  347. :key="index"
  348. class="items"
  349. v-if="!itm.formatter"
  350. >
  351. <span>{{ itm.label }}</span
  352. >{{ item[itm.prop] }}
  353. </div>
  354. <div class="items">
  355. <span>数量</span>
  356. <input
  357. style="width: 30% !important"
  358. v-model="item.demandQuantity"
  359. />
  360. </div>
  361. <div
  362. class="items"
  363. v-if="item.isSelection && item.isSelection == '1'"
  364. >
  365. <span>产出工序</span>
  366. <el-select v-model="item.taskId" placeholder="请选择">
  367. <el-option
  368. v-for="item in outObj.taskDataList"
  369. :key="item.taskId"
  370. :label="item.taskTypeName"
  371. :value="item.taskId"
  372. >
  373. </el-option>
  374. </el-select>
  375. </div>
  376. <div>
  377. <el-button
  378. type="text"
  379. @click="deleteOutput(index)"
  380. style="color: red"
  381. >删除</el-button
  382. >
  383. </div>
  384. </div>
  385. </div>
  386. </label>
  387. </div>
  388. </div>
  389. </el-tab-pane>
  390. </el-tabs>
  391. <div class="operate_box">
  392. <el-button
  393. size="small"
  394. class="u-reset-button"
  395. @click="close"
  396. style="margin-left: 10px"
  397. >
  398. 取消
  399. </el-button>
  400. <el-button
  401. type="primary"
  402. size="small"
  403. class="u-reset-button"
  404. @click="handOK(0)"
  405. >
  406. 确认
  407. </el-button>
  408. <el-button
  409. type="primary"
  410. size="small"
  411. class="u-reset-button"
  412. @click="handOK(1)"
  413. >
  414. 提交
  415. </el-button>
  416. </div>
  417. <pickingList
  418. ref="pickingListRef"
  419. isType="weiwai"
  420. @allSelection="allSelection"
  421. ></pickingList>
  422. </div>
  423. </template>
  424. <script>
  425. import {
  426. // checkOutsourceMaterial,
  427. applyoutsourceSave
  428. // getWarehouseList
  429. } from '@/api/produce/index.js';
  430. import { tableHeader } from '@/utils/dict/common.js';
  431. // import {
  432. // EventBus
  433. // } from '@/utils/eventBus.js'
  434. import pickingList from './pickingList.vue';
  435. export default {
  436. components: { pickingList },
  437. data() {
  438. return {
  439. checkListLen: 0,
  440. checkedAll: true,
  441. checkList: [],
  442. mode: 'center',
  443. show: false,
  444. topHight: 20 || 20,
  445. activeName: '0',
  446. outObj: {
  447. name: '111',
  448. type: 4,
  449. isInWarehouse: 1
  450. },
  451. tabList: [
  452. {
  453. name: '物品清单'
  454. },
  455. {
  456. name: '带料清单'
  457. },
  458. {
  459. name: '产出清单'
  460. }
  461. ],
  462. actTab: '物品清单',
  463. datapickOutInList: [],
  464. bomMaterialList: [],
  465. pickOutInList: [],
  466. materialList: [],
  467. standardOutputList: [],
  468. isFirstTask: null,
  469. isLoading: null,
  470. // clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  471. // .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  472. seletedAll: false, //全选状态
  473. checkListLen: 0,
  474. warehouseList: [],
  475. pickOutInListSelect: [],
  476. selectionIds: [],
  477. newStepsList: []
  478. };
  479. },
  480. created() {
  481. // EventBus.$on('outEvent', this.handleEvent);
  482. // this.outsourceMaterialFn()
  483. },
  484. computed: {
  485. clientEnvironmentId() {
  486. return this.$store.state.user.info.clientEnvironmentId;
  487. }
  488. },
  489. props: {
  490. outsourceFormVal: {
  491. type: Object,
  492. default: () => {}
  493. }
  494. },
  495. watch: {
  496. outsourceFormVal: {
  497. handler(val) {
  498. console.log(val, 'outsourceFormVal');
  499. this.outsourceMaterialFn(val);
  500. this.outObj = val;
  501. },
  502. deep: true,
  503. immediate: true
  504. }
  505. },
  506. methods: {
  507. // open(obj) {
  508. // // this.outObj = obj;
  509. // this.actTab = '物品清单';
  510. // // this.outsourceMaterialFn()
  511. // // this.getWarehouseFn()
  512. // },
  513. allSelection(e, item, type) {
  514. if (e == 2) {
  515. if (type == 'goods') {
  516. item.map((it) => {
  517. it.isSelection = '1';
  518. it.categoryCode = it.code;
  519. it.feedQuantity = 1;
  520. it.categoryId = it.id;
  521. it.newWeight = it.weight;
  522. this.pickOutInList.push(this.deepCopy(it));
  523. });
  524. this.selectionData();
  525. } else {
  526. if (item.length) {
  527. item.map((v) => {
  528. this.bomMaterialList.push(v);
  529. });
  530. }
  531. }
  532. } else if (e == 3) {
  533. if (item.length) {
  534. item.map((it) => {
  535. it.isSelection = '1';
  536. it.categoryCode = it.code;
  537. it.feedQuantity = 1;
  538. it.categoryId = it.id;
  539. it.newWeight = it.weight;
  540. it.rootCategoryLevelId = it.categoryLevelPathIdParent;
  541. it.taskId = '';
  542. it.taskName = '';
  543. this.standardOutputList.push(this.deepCopy(it));
  544. });
  545. // this.standardOutputList = item;
  546. }
  547. }
  548. },
  549. // selectionData(ids) {
  550. // this.$nextTick(() => {
  551. // this.tableData.forEach((row) => {
  552. // if (ids.includes(row.id)) {
  553. // this.$refs.table.toggleRowSelection(row, true);
  554. // }
  555. // });
  556. // });
  557. // },
  558. deepCopy(obj, hash = new WeakMap()) {
  559. if (obj === null) return null;
  560. if (obj instanceof Date) return new Date(obj);
  561. if (obj instanceof RegExp) return new RegExp(obj);
  562. if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
  563. if (hash.has(obj)) return hash.get(obj);
  564. const result = Array.isArray(obj) ? [] : {};
  565. hash.set(obj, result);
  566. return Object.keys(obj).reduce((acc, key) => {
  567. acc[key] = this.deepCopy(obj[key], hash);
  568. return acc;
  569. }, result);
  570. },
  571. openPicking(id, type) {
  572. this.$refs.pickingListRef.open(id, type);
  573. },
  574. outsourceMaterialFn(res) {
  575. let _arr = [];
  576. _arr = [...res.pickOutInList, ...res.materialList];
  577. this.pickOutInList = _arr.reduce((acc, item) => {
  578. const existingItem = acc.find((existing) => existing.id === item.id);
  579. if (!existingItem) {
  580. item.isSelection = '2';
  581. acc.push(item);
  582. }
  583. return acc;
  584. }, []);
  585. this.bomMaterialList = res.bomMaterialList.map((m) => {
  586. return {
  587. ...m,
  588. isDemandQuantity: true
  589. };
  590. });
  591. this.pickOutInList.map((v) => {
  592. v.checked = true;
  593. });
  594. this.checkListLen = this.pickOutInList.length;
  595. this.standardOutputList = res.standardOutputList;
  596. // let param = {
  597. // taskId: this.outObj.taskId,
  598. // taskIds: this.outObj.taskIds,
  599. // workOrderId: this.outObj.workOrderId
  600. // }
  601. // checkOutsourceMaterial(param).then(res => {
  602. // let _arr = []
  603. // _arr = [...res.pickOutInList, ...res.materialList]
  604. // this.pickOutInList = _arr.reduce((acc, item) => {
  605. // const existingItem = acc.find(existing => existing.id === item.id);
  606. // if (!existingItem) {
  607. // acc.push(item);
  608. // }
  609. // return acc;
  610. // }, []);
  611. // this.bomMaterialList = res.bomMaterialList.map((m) => {
  612. // return {
  613. // ...m,
  614. // isDemandQuantity: true
  615. // }
  616. // })
  617. // this.standardOutputList = res.standardOutputList
  618. // this.$forceUpdate()
  619. // })
  620. this.$nextTick(() => {
  621. this.$refs.pickOutRef.toggleAllSelection();
  622. });
  623. },
  624. inputNum(item, index) {
  625. if (item.feedQuantity) {
  626. const totalWeight = Number(item.feedQuantity) * Number(item.weight);
  627. this.$set(this.pickOutInList[index], 'newWeight', totalWeight);
  628. this.$forceUpdate();
  629. } else {
  630. this.$set(this.pickOutInList[index], 'newWeight', item.weight);
  631. this.$forceUpdate();
  632. }
  633. },
  634. // 仓库
  635. getWarehouseFn() {
  636. getWarehouseList().then((res) => {
  637. this.warehouseList = res;
  638. });
  639. },
  640. deleteData(item, index) {
  641. this.pickOutInList.splice(index, 1);
  642. },
  643. handTab(item) {
  644. this.actTab = item.name;
  645. },
  646. //关闭弹窗
  647. close() {
  648. this.$emit('closeForm');
  649. },
  650. handleEvent({ message }) {
  651. if (message.pid == 3) {
  652. this.standardOutputList = message.memoList;
  653. } else {
  654. if (message.pid == 2) {
  655. this.bomMaterialList = message.memoList;
  656. }
  657. }
  658. },
  659. tableH(type) {
  660. return tableHeader(type);
  661. },
  662. //勾选
  663. selectVal(e, val, index) {
  664. this.$forceUpdate();
  665. this.pickOutInList[index] = val;
  666. this.$set(this, 'pickOutInList', this.pickOutInList);
  667. this.checkListLen = this.pickOutInList.filter(
  668. (f) => f.checked == true
  669. ).length;
  670. },
  671. _seletedAll() {
  672. console.log(this.seletedAll, this.pickOutInList, 'this.seletedAll');
  673. // this.seletedAll true 是全选
  674. if (!this.seletedAll) {
  675. // 非全选
  676. this.seletedAll = true;
  677. this.checkListLen = 0;
  678. this.pickOutInList.map((item) => {
  679. item.checked = false;
  680. });
  681. this.$set(this, 'pickOutInList', this.pickOutInList);
  682. } else {
  683. this.seletedAll = false;
  684. this.pickOutInList.map((item) => {
  685. item.checked = true;
  686. });
  687. this.$set(this, 'pickOutInList', this.pickOutInList);
  688. }
  689. this.checkListLen = this.pickOutInList.filter(
  690. (f) => f.checked == true
  691. ).length;
  692. },
  693. selectionPickOut(val) {
  694. this.pickOutInListSelect = val;
  695. },
  696. deleteOutput(index) {
  697. this.standardOutputList.splice(index, 1);
  698. },
  699. deleteBomMaterial(item, index) {
  700. this.bomMaterialList.splice(index, 1);
  701. },
  702. convertList(item, index) {
  703. if (item.demandQuantity) {
  704. item.categoryCode = item.code;
  705. item.feedQuantity = item.demandQuantity;
  706. item.isSelection = '1';
  707. item.categoryId = item.id;
  708. item.newWeight = item.weight;
  709. this.pickOutInList.push(this.deepCopy(item));
  710. this.selectionData();
  711. this.bomMaterialList.splice(index, 1);
  712. this.$forceUpdate();
  713. } else {
  714. return this.$message({
  715. message: '请输入转换数量',
  716. type: 'warning'
  717. });
  718. }
  719. },
  720. selectionData() {
  721. this.$nextTick(() => {
  722. this.$refs.pickOutRef.toggleAllSelection();
  723. });
  724. },
  725. scrolltolower() {},
  726. addPicking(id) {
  727. const storageKey = Date.now() + '';
  728. let arr = null;
  729. if (id == 3) {
  730. arr = [
  731. {
  732. standardOutputList: this.standardOutputList
  733. }
  734. ];
  735. } else {
  736. arr = [
  737. {
  738. bomMaterialList: this.bomMaterialList
  739. }
  740. ];
  741. }
  742. // uni.setStorageSync(storageKey, arr);
  743. // uni.navigateTo({
  744. // url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=zdy&taskId=${this.outObj.taskId}&classIds=[1,23,9]`
  745. // })
  746. },
  747. handOK(isRelease) {
  748. // isRelease? 0 提交 2提交并发布
  749. if (this.checkListLen > 0 && !this.outObj.warehouseId) {
  750. return this.$message({
  751. message: '请选择仓库',
  752. type: 'warning'
  753. });
  754. }
  755. // 环境判断
  756. let _pickOutInList = [];
  757. if (this.clientEnvironmentId == 2) {
  758. _pickOutInList = this.pickOutInList;
  759. } else {
  760. // _pickOutInList = this.pickOutInList.filter(f => f.checked == true)
  761. _pickOutInList = this.pickOutInListSelect;
  762. }
  763. for (let i = 0; i < _pickOutInList.length; i++) {
  764. if (
  765. !_pickOutInList[i].feedQuantity &&
  766. _pickOutInList[i].isSelection == '1'
  767. ) {
  768. this.$message.warning('物品数量不能为空');
  769. return;
  770. }
  771. }
  772. let param = {
  773. ...this.outObj,
  774. isRelease: isRelease,
  775. bomMaterialList: this.bomMaterialList,
  776. pickOutInList: _pickOutInList,
  777. materialList: this.materialList,
  778. standardOutputList: this.standardOutputList
  779. };
  780. this.isLoading = this.$loading({
  781. lock: true,
  782. text: '加载中',
  783. background: 'rgba(0, 0, 0, 0.7)'
  784. });
  785. applyoutsourceSave(param)
  786. .then((res) => {
  787. this.$emit('outScucc');
  788. this.isLoading.close();
  789. return this.$message({
  790. message: '提交成功',
  791. type: 'scuccess'
  792. });
  793. this.checkListLen = 0;
  794. })
  795. .catch(() => {
  796. this.isLoading.close();
  797. });
  798. }
  799. }
  800. };
  801. </script>
  802. <style lang="scss" scoped>
  803. .c_header_title {
  804. display: flex;
  805. align-items: center;
  806. margin-bottom: 0;
  807. height: 58px;
  808. margin-bottom: 10px;
  809. box-sizing: border-box;
  810. border-bottom: 1px solid var(--border-color-lighter);
  811. }
  812. .operate_box {
  813. display: flex;
  814. flex-direction: row-reverse;
  815. padding: 15px;
  816. box-shadow: 0px -2px 15px 0px rgba(0, 0, 0, 0.1);
  817. }
  818. .c_title {
  819. color: #157a2c;
  820. font-size: 16px;
  821. font-weight: bold;
  822. }
  823. .materialList {
  824. height: 50vh;
  825. overflow: auto;
  826. }
  827. .card {
  828. width: 100%;
  829. padding: 0 20px;
  830. }
  831. .u-reset {
  832. width: 100%;
  833. padding: 5px;
  834. text-align: right;
  835. }
  836. .listBox-con {
  837. width: 100%;
  838. }
  839. .gxList {
  840. margin-left: 10px;
  841. }
  842. .listBox-sel {
  843. margin: 0 10px;
  844. }
  845. .listBox-top {
  846. display: flex;
  847. padding: 15px;
  848. font-size: 14px;
  849. font-weight: bold;
  850. border-bottom: 1px solid #ddd;
  851. }
  852. .listBox-bottom {
  853. display: flex;
  854. width: 100%;
  855. flex-wrap: wrap;
  856. margin-bottom: 0;
  857. }
  858. .listBox {
  859. display: flex;
  860. align-items: center;
  861. border: 1px solid #ddd;
  862. margin-bottom: 20px;
  863. }
  864. .items {
  865. font-size: 12px;
  866. width: 23%;
  867. display: flex;
  868. align-items: center;
  869. white-space: nowrap;
  870. overflow: hidden;
  871. text-overflow: ellipsis;
  872. // border: 1px solid #ddd;
  873. // border-bottom: 1px solid #ddd;
  874. // border-right: 0;
  875. span {
  876. display: block;
  877. padding: 10px;
  878. margin-right: 5px;
  879. color: #157a2c;
  880. background-color: #f7f9fa;
  881. }
  882. }
  883. ::v-deep .el-input--medium .el-input__inner {
  884. height: 26px;
  885. line-height: 26px;
  886. }
  887. </style>