outsourceList.vue 15 KB

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