outsourceList.vue 14 KB

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