outsourceList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  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. let _arr = []
  238. _arr= [...res.pickOutInList, ...res.materialList]
  239. this.pickOutInList = _arr.reduce((acc, item) => {
  240. const existingItem = acc.find(existing => existing.id === item.id);
  241. if (!existingItem) {
  242. acc.push(item);
  243. }
  244. return acc;
  245. }, []);
  246. this.bomMaterialList = res.bomMaterialList.map((m) => {
  247. return {
  248. ...m,
  249. isDemandQuantity: true
  250. }
  251. })
  252. this.standardOutputList = res.standardOutputList
  253. this.$forceUpdate()
  254. })
  255. },
  256. handTab(item) {
  257. this.actTab = item.name
  258. },
  259. close() {
  260. this.show = false
  261. },
  262. handleEvent({
  263. message
  264. }) {
  265. if (message.pid == 3) {
  266. this.standardOutputList = message.memoList
  267. } else {
  268. if (message.pid == 2) {
  269. this.bomMaterialList = message.memoList
  270. }
  271. }
  272. },
  273. tableH(type) {
  274. return tableHeader(type)
  275. },
  276. //勾选
  277. selectVal(e, val, index) {
  278. this.pickOutInList[index].checked = !this.pickOutInList[index].checked
  279. this.checkListLen = this.pickOutInList.filter(f => f.checked == true).length
  280. },
  281. _seletedAll() {
  282. if (!this.seletedAll) {
  283. this.seletedAll = true
  284. this.pickOutInList.map(item => {
  285. this.$set(item, 'checked', true)
  286. })
  287. } else {
  288. this.seletedAll = false
  289. this.pickOutInList.map(item => {
  290. this.$set(item, 'checked', false)
  291. })
  292. }
  293. this.checkListLen = this.pickOutInList.filter(f => f.checked == true).length
  294. },
  295. scrolltolower() {},
  296. addPicking(id) {
  297. const storageKey = Date.now() + "";
  298. let arr = null
  299. if (id == 3) {
  300. arr = [{
  301. standardOutputList: this.standardOutputList,
  302. }]
  303. } else {
  304. arr = [{
  305. bomMaterialList: this.bomMaterialList,
  306. }]
  307. }
  308. uni.setStorageSync(storageKey, arr);
  309. uni.navigateTo({
  310. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=zdy&taskId=${this.outObj.taskId}&classIds=[1,23,9]`
  311. })
  312. },
  313. handOK(isRelease) {
  314. let param = {
  315. ...this.outObj,
  316. isRelease: isRelease,
  317. bomMaterialList: this.bomMaterialList,
  318. pickOutInList: this.pickOutInList.filter(f => f.checked == true),
  319. materialList: this.materialList,
  320. standardOutputList: this.standardOutputList,
  321. }
  322. applyoutsourceSave(param).then(res => {
  323. uni.showToast({
  324. title: "提交成功",
  325. icon: "none"
  326. })
  327. this.$emit('close', true)
  328. this.checkListLen = 0
  329. this.close()
  330. })
  331. },
  332. }
  333. }
  334. </script>
  335. <style lang="scss" scoped>
  336. .z_list {
  337. max-height: 860rpx;
  338. padding: 10rpx;
  339. box-sizing: border-box;
  340. }
  341. .box_list {
  342. min-height: 100rpx;
  343. width: 96vw;
  344. /deep/ .baseForm {
  345. padding: 0 20rpx;
  346. }
  347. }
  348. .operate_box {
  349. padding: 10rpx 32rpx;
  350. /deep/ .u-button {
  351. width: 28%;
  352. }
  353. }
  354. /deep/ .u-tabs__wrapper__nav {
  355. background: #f5f5f5 !important;
  356. }
  357. .listBox {
  358. margin-top: 8rpx;
  359. padding: 8rpx 24rpx;
  360. background: #fff;
  361. /deep/ .uni-checkbox-input-checked {
  362. background-color: $theme-color !important;
  363. border-color: $theme-color !important;
  364. }
  365. .listBox-sel {
  366. margin-top: 10rpx;
  367. margin-right: 8rpx;
  368. .round {
  369. width: 32rpx;
  370. height: 32rpx;
  371. line-height: 32rpx;
  372. text-align: center;
  373. border-radius: 50%;
  374. background: $theme-color;
  375. font-size: 24rpx;
  376. font-style: normal;
  377. font-weight: 400;
  378. color: #fff;
  379. }
  380. }
  381. .round {
  382. width: 32rpx;
  383. height: 32rpx;
  384. line-height: 32rpx;
  385. text-align: center;
  386. border-radius: 50%;
  387. background: $theme-color;
  388. font-size: 24rpx;
  389. font-style: normal;
  390. font-weight: 400;
  391. color: #fff;
  392. }
  393. .listBox-con {
  394. width: 650rpx;
  395. font-weight: 400;
  396. }
  397. .listBox-top {
  398. margin-top: 6rpx;
  399. color: #090A0A;
  400. font-size: 28rpx;
  401. font-style: normal;
  402. font-weight: 800;
  403. }
  404. .listBox-bottom {
  405. color: #090A0A;
  406. font-size: 24rpx;
  407. font-style: normal;
  408. flex-wrap: wrap;
  409. .items {
  410. width: calc(50% - 1px);
  411. border-left: 1rpx solid #E3E5E5;
  412. border-right: 1rpx solid #E3E5E5;
  413. border-bottom: 1rpx solid #E3E5E5;
  414. box-sizing: border-box;
  415. word-break: break-all;
  416. text {
  417. display: inline-block;
  418. background: #F7F9FA;
  419. padding: 8rpx 10rpx;
  420. color: #157A2C;
  421. }
  422. &:nth-child(1),
  423. &:nth-child(2) {
  424. border-top: 1rpx solid #E3E5E5;
  425. margin-top: 8rpx;
  426. }
  427. }
  428. }
  429. }
  430. .card_box {
  431. width: 92vw;
  432. padding: 16rpx 32rpx;
  433. box-sizing: border-box;
  434. border-bottom: 2rpx solid #E1E1E1;
  435. .item_box {
  436. margin-top: 10rpx;
  437. .item_one {
  438. width: 100%;
  439. font-size: 26rpx;
  440. font-style: normal;
  441. font-weight: 400;
  442. line-height: 38rpx;
  443. word-wrap: break-word;
  444. }
  445. .gylx {
  446. color: $theme-color;
  447. }
  448. .perce50 {
  449. width: 50%;
  450. }
  451. }
  452. }
  453. .content_num {
  454. display: flex;
  455. align-items: center;
  456. padding: 0 4rpx;
  457. /deep/ .uni-input-input {
  458. border: 2rpx solid #F0F8F2;
  459. background: #F0F8F2;
  460. color: $theme-color;
  461. }
  462. }
  463. </style>