outsourceList.vue 15 KB

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