outsourceList.vue 14 KB

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