outsourceList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. <template>
  2. <view>
  3. <!-- 委外下一步 -->
  4. <u-popup :show="show" :mode='mode' :closeOnClickOverlay='false'>
  5. <view class="card_box">
  6. <view class="item_box rx-bc">
  7. <view class="item_one rx-sc">
  8. <view class="lable">委外名称:</view>
  9. <view style="color: #157A2C">{{ outObj.name }}</view>
  10. </view>
  11. </view>
  12. <view class="item_box rx-bc">
  13. <view class="item_one perce50 rx-sc">
  14. <view class="lable">委外类型:</view>
  15. <view style="color: #157A2C">{{ outObj.type == 4 ? '带料委外' : '无料委外' }}</view>
  16. </view>
  17. <view class="item_one perce50 rx-sc">
  18. <view class="lable">直接入库:</view>
  19. <view style="color: #157A2C">{{ outObj.isInWarehouse == 1 ? '是' : '否' }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <u-tabs :list="tabList" @click="handTab" lineWidth="30" lineColor="#157A2C" :activeStyle="{
  24. color: '#157A2C',
  25. }" :inactiveStyle="{
  26. color: '#303133',
  27. }" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;">
  28. </u-tabs>
  29. <view class="box_list">
  30. <u-list @scrolltolower="scrolltolower" class="z_list">
  31. <view v-if="actTab == '物品清单'">
  32. <view class="rx-bc" v-if="outObj.isStraight != 1 && clientEnvironmentId != 2">
  33. <view style="margin-left: 24rpx">
  34. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选
  35. </checkbox>
  36. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll"
  37. @tap="_seletedAll">
  38. 取消全选
  39. </checkbox>
  40. </view>
  41. <view>勾选:<text style="color: #157A2C">{{ checkListLen || 0 }}个</text> </view>
  42. </view>
  43. <u-form labelPosition="left" :model="outObj" labelWidth="180" labelAlign="left" class=""
  44. v-if="checkListLen > 0 && clientEnvironmentId != 2">
  45. <u-form-item label="收货仓库:" borderBottom prop="warehouseId">
  46. <zxz-uni-data-select :localdata="warehouseList" v-model="outObj.warehouseId"
  47. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  48. </u-form-item>
  49. </u-form>
  50. <checkbox-group v-for="(item, index) in pickOutInList" :key="index"
  51. @change="e => selectVal(e, item, index)">
  52. <label class="listBox rx-bs">
  53. <view class="listBox-sel">
  54. <checkbox
  55. v-if=' (item.rootCategoryLevelId != 11 || (item.rootCategoryLevelId == 11 && item.status != 1)) && clientEnvironmentId != 2'
  56. :value="item.code" color="#fff" :disabled="outObj.isStraight == 1"
  57. :checked="item.checked" />
  58. </view>
  59. <view class="listBox-con">
  60. <view class="listBox-top rx-bc">
  61. <view> {{ item.name }}</view>
  62. <view class="code">
  63. {{ item.rootCategoryLevelId == 4 ? item.codeNumber : item.code}}
  64. </view>
  65. </view>
  66. <view class="listBox-bottom rx">
  67. <view v-for="(itm, index) in tableH(item.rootCategoryLevelId)" :key="index"
  68. class="items" v-if="!itm.formatter">
  69. <text>{{ itm.label }}</text>{{ item[itm.prop] }}
  70. </view>
  71. <view class="items"
  72. v-if='(item.rootCategoryLevelId == 1 && item.isConsumable == 1) && item.rootCategoryLevelId != 11 && item.rootCategoryLevelId != 4 '>
  73. <text>可用库存</text>{{ item.availableCountBase }} {{item.unit}}
  74. </view>
  75. <view class="items"
  76. v-if='([1,2,9,23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 0) '>
  77. <text>刻码</text>{{item.extInfo.engrave }}
  78. </view>
  79. <view class="items"
  80. v-if='([1,2,9,23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 0) '>
  81. <text>物料代号</text>{{item.extInfo.materielCode }}
  82. </view>
  83. <view class="items"
  84. v-if='([1,2,9,23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 0) '>
  85. <text>客户代号</text>{{item.extInfo.clientCode }}
  86. </view>
  87. <view class="items"
  88. v-if='([1,2,9,23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 0) '>
  89. <text>重量</text>{{item.extInfo.newWeight }} {{item.extInfo.weightUnit}}
  90. </view>
  91. <view class="items"
  92. v-if='([1,2,9,23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 1) '>
  93. <text>数量</text>{{item.feedQuantity}}
  94. </view>
  95. <view class="items"
  96. v-if='([1,2,9,23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 1) '>
  97. <text>重量</text>{{item.weight || 0}} {{ item.weightUnit}}
  98. </view>
  99. <view class="items"
  100. v-if='([1,2,9,23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 1) '>
  101. <text>规格</text> {{ item.specification}}
  102. </view>
  103. <view class="items"
  104. v-if='([1,2,9,23].includes(Number(item.rootCategoryLevelId)) && item.isConsumable == 1) '>
  105. <text>型号</text> {{ item.modelType}}
  106. </view>
  107. </view>
  108. </view>
  109. </label>
  110. </checkbox-group>
  111. </view>
  112. <view v-if="actTab == '带料清单'">
  113. <view class="title_box rx-bc">
  114. <view></view>
  115. <view class="right_box rx-ec">
  116. <u-button type="success" size="small" class="u-reset-button" @click="addPicking(2)"
  117. text="添加"></u-button>
  118. </view>
  119. </view>
  120. <view v-for="(item, index) in bomMaterialList" :key="index">
  121. <label class="listBox rx-bs">
  122. <view class="listBox-sel">
  123. <view class="round">{{index + 1}}</view>
  124. </view>
  125. <view class="listBox-con">
  126. <view class="listBox-bottom rx">
  127. <view class="items">
  128. <text>名称</text>{{ item.name }}
  129. </view>
  130. <view class="items">
  131. <text>编码</text>{{ item.code }}
  132. </view>
  133. <view v-for="(itm, index) in tableH(item.rootCategoryLevelId)" :key="index"
  134. class="items" v-if="!itm.formatter">
  135. <text>{{ itm.label }}</text>{{ item[itm.prop] }}
  136. </view>
  137. <view class="items" v-if="item.isDemandQuantity && clientEnvironmentId != 2">
  138. <text>数量</text>{{ checkListLen == 0 ? item.demandQuantity : item.count * ( checkListLen || 1 ) }}
  139. </view>
  140. <view class="items content_num"
  141. v-if="!item.isDemandQuantity && clientEnvironmentId != 2">
  142. <text>数量</text> <input style="8px !important"
  143. v-model="item.demandQuantity"></input>
  144. </view>
  145. <view class="items" v-if="item.isDemandQuantity && clientEnvironmentId == 2">
  146. <text>数量</text>{{ item.count * ( outObj.formedNumLast || 1 ) }}
  147. </view>
  148. <view class="items content_num"
  149. v-if="!item.isDemandQuantity && clientEnvironmentId == 2">
  150. <text>数量</text> <input style="8rpx !important"
  151. v-model="item.demandQuantity"></input>
  152. </view>
  153. </view>
  154. </view>
  155. </label>
  156. </view>
  157. </view>
  158. <view v-if="actTab == '产出清单'">
  159. <view class="title_box rx-bc">
  160. <view></view>
  161. <view class="right_box rx-ec">
  162. <u-button type="success" size="small" class="u-reset-button" @click="addPicking(3)"
  163. text="添加"></u-button>
  164. </view>
  165. </view>
  166. <view v-for="(item, index) in standardOutputList" :key="index">
  167. <label class="listBox rx-bs">
  168. <view class="listBox-sel">
  169. <view class="round">{{index + 1}}</view>
  170. </view>
  171. <view class="listBox-con">
  172. <view class="listBox-bottom rx">
  173. <view class="items">
  174. <text>名称</text>{{ item.name }}
  175. </view>
  176. <view class="items">
  177. <text>编码</text>{{ item.code }}
  178. </view>
  179. <view v-for="(itm, index) in tableH(item.rootCategoryLevelId)" :key="index"
  180. class="items" v-if="!itm.formatter">
  181. <text>{{ itm.label }}</text>{{ item[itm.prop] }}
  182. </view>
  183. <view class="items content_num">
  184. <text>数量</text> <input style="8rpx !important"
  185. v-model="item.demandQuantity"></input>
  186. </view>
  187. </view>
  188. </view>
  189. </label>
  190. </view>
  191. </view>
  192. </u-list>
  193. <view class="operate_box rx-bc">
  194. <u-button size="small" class="u-reset-button" @click="close">
  195. 取消
  196. </u-button>
  197. <u-button type="success" size="small" class="u-reset-button" @click="handOK(0)">
  198. 提交
  199. </u-button>
  200. <u-button type="success" size="small" class="u-reset-button" @click="handOK(1)">
  201. 提交并发布
  202. </u-button>
  203. </view>
  204. </view>
  205. </u-popup>
  206. </view>
  207. </template>
  208. <script>
  209. import {
  210. checkOutsourceMaterial,
  211. applyoutsourceSave,
  212. getWarehouseList
  213. } from '@/api/pda/workOrder.js'
  214. import {
  215. tableHeader
  216. } from '../common.js'
  217. import {
  218. EventBus
  219. } from '@/utils/eventBus.js'
  220. export default {
  221. data() {
  222. return {
  223. mode: 'center',
  224. show: false,
  225. topHight: 20 || 20,
  226. outObj: {},
  227. tabList: [{
  228. name: '物品清单'
  229. },
  230. {
  231. name: '带料清单'
  232. },
  233. {
  234. name: '产出清单'
  235. }
  236. ],
  237. actTab: '物品清单',
  238. bomMaterialList: [],
  239. pickOutInList: [],
  240. materialList: [],
  241. standardOutputList: [],
  242. isFirstTask: null,
  243. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  244. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  245. seletedAll: false, //全选状态
  246. checkListLen: 0,
  247. warehouseList: []
  248. }
  249. },
  250. created() {
  251. EventBus.$on('outEvent', this.handleEvent);
  252. },
  253. computed: {
  254. },
  255. methods: {
  256. open(obj) {
  257. this.outObj = obj
  258. this.actTab = '物品清单',
  259. this.outsourceMaterialFn()
  260. this.getWarehouseFn()
  261. this.show = true
  262. },
  263. outsourceMaterialFn() {
  264. let param = {
  265. taskId: this.outObj.taskId,
  266. taskIds: this.outObj.taskIds,
  267. workOrderId: this.outObj.workOrderId,
  268. quantity: this.outObj.formedNumLast
  269. }
  270. checkOutsourceMaterial(param).then(res => {
  271. let _arr = []
  272. _arr = [...res.pickOutInList, ...res.materialList]
  273. this.pickOutInList = _arr.reduce((acc, item) => {
  274. const existingItem = acc.find(existing => existing.id === item.id);
  275. if (!existingItem) {
  276. acc.push(item);
  277. }
  278. return acc;
  279. }, []);
  280. this.bomMaterialList = res.bomMaterialList.map((m) => {
  281. return {
  282. ...m,
  283. isDemandQuantity: true
  284. }
  285. })
  286. this.standardOutputList = res.standardOutputList
  287. this.$forceUpdate()
  288. })
  289. },
  290. // 仓库
  291. getWarehouseFn() {
  292. getWarehouseList().then(res => {
  293. this.warehouseList = res
  294. })
  295. },
  296. handTab(item) {
  297. this.actTab = item.name
  298. },
  299. close() {
  300. this.show = false
  301. },
  302. handleEvent({
  303. message
  304. }) {
  305. console.log(message,'message999999999999');
  306. if (message.pid == 3) {
  307. this.standardOutputList = [...this.standardOutputList,...message.memoList];
  308. } else {
  309. if (message.pid == 2) {
  310. this.bomMaterialList = message.memoList
  311. // console.log(this.bomMaterialList,'1111111111');
  312. // return
  313. }
  314. }
  315. },
  316. tableH(type) {
  317. return tableHeader(type)
  318. },
  319. //勾选
  320. selectVal(e, val, index) {
  321. this.pickOutInList[index].checked = !this.pickOutInList[index].checked
  322. this.checkListLen = this.pickOutInList.filter(f => f.checked == true).length
  323. },
  324. _seletedAll() {
  325. if (!this.seletedAll) {
  326. this.seletedAll = true
  327. this.pickOutInList.map(item => {
  328. this.$set(item, 'checked', true)
  329. })
  330. } else {
  331. this.seletedAll = false
  332. this.pickOutInList.map(item => {
  333. this.$set(item, 'checked', false)
  334. })
  335. }
  336. this.checkListLen = this.pickOutInList.filter(f => f.checked == true).length
  337. },
  338. scrolltolower() {},
  339. addPicking(id) {
  340. const storageKey = Date.now() + "";
  341. let arr = null
  342. if (id == 3) {
  343. arr = [{
  344. standardOutputList: this.standardOutputList,
  345. }]
  346. } else {
  347. arr = [{
  348. bomMaterialList: this.bomMaterialList,
  349. }]
  350. }
  351. uni.setStorageSync(storageKey, arr);
  352. uni.navigateTo({
  353. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=weiwai&taskId=${this.outObj.taskId}&classIds=[1,23,9]`
  354. })
  355. },
  356. handOK(isRelease) {
  357. if (this.checkListLen > 0 && !this.outObj.warehouseId) {
  358. uni.showToast({
  359. title: "请选择仓库",
  360. icon: "none"
  361. })
  362. return
  363. }
  364. let _pickOutInList = []
  365. if (this.clientEnvironmentId == 2) {
  366. _pickOutInList = this.pickOutInList
  367. } else {
  368. _pickOutInList = this.pickOutInList.filter(f => f.checked == true)
  369. }
  370. let param = {
  371. ...this.outObj,
  372. isRelease: isRelease,
  373. bomMaterialList: this.bomMaterialList,
  374. pickOutInList: _pickOutInList,
  375. materialList: this.materialList,
  376. standardOutputList: this.standardOutputList,
  377. }
  378. applyoutsourceSave(param).then(res => {
  379. uni.showToast({
  380. title: "提交成功",
  381. icon: "none"
  382. })
  383. this.$emit('close', true)
  384. this.checkListLen = 0
  385. this.close()
  386. })
  387. },
  388. }
  389. }
  390. </script>
  391. <style lang="scss" scoped>
  392. .z_list {
  393. max-height: 860rpx;
  394. padding: 10rpx;
  395. box-sizing: border-box;
  396. }
  397. .box_list {
  398. min-height: 100rpx;
  399. width: 96vw;
  400. /deep/ .baseForm {
  401. padding: 0 20rpx;
  402. }
  403. }
  404. .operate_box {
  405. padding: 10rpx 32rpx;
  406. /deep/ .u-button {
  407. width: 28%;
  408. }
  409. }
  410. /deep/ .u-tabs__wrapper__nav {
  411. background: #f5f5f5 !important;
  412. }
  413. .listBox {
  414. margin-top: 8rpx;
  415. padding: 8rpx 24rpx;
  416. background: #fff;
  417. /deep/ .uni-checkbox-input-checked {
  418. background-color: $theme-color !important;
  419. border-color: $theme-color !important;
  420. }
  421. .listBox-sel {
  422. margin-top: 10rpx;
  423. margin-right: 8rpx;
  424. .round {
  425. width: 32rpx;
  426. height: 32rpx;
  427. line-height: 32rpx;
  428. text-align: center;
  429. border-radius: 50%;
  430. background: $theme-color;
  431. font-size: 24rpx;
  432. font-style: normal;
  433. font-weight: 400;
  434. color: #fff;
  435. }
  436. }
  437. .round {
  438. width: 32rpx;
  439. height: 32rpx;
  440. line-height: 32rpx;
  441. text-align: center;
  442. border-radius: 50%;
  443. background: $theme-color;
  444. font-size: 24rpx;
  445. font-style: normal;
  446. font-weight: 400;
  447. color: #fff;
  448. }
  449. .listBox-con {
  450. width: 650rpx;
  451. font-weight: 400;
  452. }
  453. .listBox-top {
  454. margin-top: 6rpx;
  455. color: #090A0A;
  456. font-size: 28rpx;
  457. font-style: normal;
  458. font-weight: 800;
  459. }
  460. .listBox-bottom {
  461. color: #090A0A;
  462. font-size: 24rpx;
  463. font-style: normal;
  464. flex-wrap: wrap;
  465. .items {
  466. width: calc(50% - 1px);
  467. border-left: 1rpx solid #E3E5E5;
  468. border-right: 1rpx solid #E3E5E5;
  469. border-bottom: 1rpx solid #E3E5E5;
  470. box-sizing: border-box;
  471. word-break: break-all;
  472. text {
  473. display: inline-block;
  474. background: #F7F9FA;
  475. padding: 8rpx 10rpx;
  476. color: #157A2C;
  477. }
  478. &:nth-child(1),
  479. &:nth-child(2) {
  480. border-top: 1rpx solid #E3E5E5;
  481. margin-top: 8rpx;
  482. }
  483. }
  484. }
  485. }
  486. .card_box {
  487. width: 92vw;
  488. padding: 16rpx 32rpx;
  489. box-sizing: border-box;
  490. border-bottom: 2rpx solid #E1E1E1;
  491. .item_box {
  492. margin-top: 10rpx;
  493. .item_one {
  494. width: 100%;
  495. font-size: 26rpx;
  496. font-style: normal;
  497. font-weight: 400;
  498. line-height: 38rpx;
  499. word-wrap: break-word;
  500. }
  501. .gylx {
  502. color: $theme-color;
  503. }
  504. .perce50 {
  505. width: 50%;
  506. }
  507. }
  508. }
  509. .content_num {
  510. display: flex;
  511. align-items: center;
  512. padding: 0 4rpx;
  513. /deep/ .uni-input-input {
  514. border: 2rpx solid #F0F8F2;
  515. background: #F0F8F2;
  516. color: $theme-color;
  517. }
  518. }
  519. </style>