outsourceList.vue 14 KB

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