outsourceList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  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.isStraight == 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="8rpx !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>
  154. </view>
  155. </label>
  156. </view>
  157. </view>
  158. </u-list>
  159. <view class="operate_box rx-bc">
  160. <u-button size="small" class="u-reset-button" @click="close">
  161. 取消
  162. </u-button>
  163. <u-button type="success" size="small" class="u-reset-button" @click="handOK">
  164. 提交
  165. </u-button>
  166. </view>
  167. </view>
  168. </u-popup>
  169. </view>
  170. </template>
  171. <script>
  172. import {
  173. checkOutsourceMaterial,
  174. applyoutsourceSave
  175. } from '@/api/pda/workOrder.js'
  176. import {
  177. tableHeader
  178. } from '../common.js'
  179. import {
  180. EventBus
  181. } from '@/utils/eventBus.js'
  182. export default {
  183. data() {
  184. return {
  185. mode: 'center',
  186. show: false,
  187. topHight: 20 || 20,
  188. outObj: {},
  189. tabList: [{
  190. name: '物品清单'
  191. },
  192. {
  193. name: '带料清单'
  194. },
  195. {
  196. name: '产出清单'
  197. }
  198. ],
  199. actTab: '物品清单',
  200. bomMaterialList: [],
  201. pickOutInList: [],
  202. materialList: [],
  203. standardOutputList: [],
  204. isFirstTask: null,
  205. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  206. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  207. seletedAll: false, //全选状态
  208. checkListLen: 0
  209. }
  210. },
  211. created() {
  212. EventBus.$on('outEvent', this.handleEvent);
  213. },
  214. computed: {
  215. },
  216. methods: {
  217. open(obj) {
  218. this.outObj = obj
  219. this.actTab = '物品清单',
  220. this.outsourceMaterialFn()
  221. this.show = true
  222. },
  223. outsourceMaterialFn() {
  224. let param = {
  225. taskId: this.outObj.taskId,
  226. taskIds: this.outObj.taskIds,
  227. workOrderId: this.outObj.workOrderId
  228. }
  229. checkOutsourceMaterial(param).then(res => {
  230. if (this.clientEnvironmentId == 3 && res.isFirstTask == 1) {
  231. this.pickOutInList = [...res.pickOutInList, ...res.materialList]
  232. } else {
  233. this.pickOutInList = res.pickOutInList
  234. }
  235. this.bomMaterialList = res.bomMaterialList.map((m) => {
  236. return {
  237. ...m,
  238. isDemandQuantity: true
  239. }
  240. })
  241. this.standardOutputList = res.standardOutputList
  242. this.$forceUpdate()
  243. })
  244. },
  245. handTab(item) {
  246. this.actTab = item.name
  247. },
  248. close() {
  249. this.show = false
  250. },
  251. handleEvent({
  252. message
  253. }) {
  254. if (message.pid == 3) {
  255. this.standardOutputList = message.memoList
  256. } else {
  257. if (message.pid == 2) {
  258. this.bomMaterialList = message.memoList
  259. }
  260. }
  261. },
  262. tableH(type) {
  263. return tableHeader(type)
  264. },
  265. //勾选
  266. selectVal(e, val, index) {
  267. this.pickOutInList[index].checked = !this.pickOutInList[index].checked
  268. this.checkListLen = this.pickOutInList.filter(f => f.checked == true).length
  269. },
  270. _seletedAll() {
  271. if (!this.seletedAll) {
  272. this.seletedAll = true
  273. this.pickOutInList.map(item => {
  274. this.$set(item, 'checked', true)
  275. })
  276. } else {
  277. this.seletedAll = false
  278. this.pickOutInList.map(item => {
  279. this.$set(item, 'checked', false)
  280. })
  281. }
  282. this.checkListLen = this.pickOutInList.filter(f => f.checked == true).length
  283. },
  284. scrolltolower() {},
  285. addPicking(id) {
  286. const storageKey = Date.now() + "";
  287. let arr = null
  288. if (id == 3) {
  289. arr = [{
  290. standardOutputList: this.standardOutputList,
  291. }]
  292. } else {
  293. arr = [{
  294. bomMaterialList: this.bomMaterialList,
  295. }]
  296. }
  297. uni.setStorageSync(storageKey, arr);
  298. uni.navigateTo({
  299. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=zdy&taskId=${this.outObj.taskId}&classIds=[1,23,9]`
  300. })
  301. },
  302. handOK() {
  303. let param = {
  304. ...this.outObj,
  305. isRelease: 0,
  306. bomMaterialList: this.bomMaterialList,
  307. pickOutInList: this.pickOutInList.filter(f => f.checked == true),
  308. materialList: this.materialList,
  309. standardOutputList: this.standardOutputList,
  310. }
  311. applyoutsourceSave(param).then(res => {
  312. uni.showToast({
  313. title: "提交成功",
  314. icon: "none"
  315. })
  316. this.$emit('close', true)
  317. this.checkListLen = 0
  318. this.close()
  319. })
  320. },
  321. }
  322. }
  323. </script>
  324. <style lang="scss" scoped>
  325. .z_list {
  326. max-height: 860rpx;
  327. padding: 10rpx;
  328. box-sizing: border-box;
  329. }
  330. .box_list {
  331. min-height: 100rpx;
  332. width: 96vw;
  333. /deep/ .baseForm {
  334. padding: 0 20rpx;
  335. }
  336. }
  337. .operate_box {
  338. padding: 10rpx 32rpx;
  339. /deep/ .u-button {
  340. width: 40%;
  341. }
  342. }
  343. /deep/ .u-tabs__wrapper__nav {
  344. background: #f5f5f5 !important;
  345. }
  346. .listBox {
  347. margin-top: 8rpx;
  348. padding: 8rpx 24rpx;
  349. background: #fff;
  350. /deep/ .uni-checkbox-input-checked {
  351. background-color: $theme-color !important;
  352. border-color: $theme-color !important;
  353. }
  354. .listBox-sel {
  355. margin-top: 10rpx;
  356. margin-right: 8rpx;
  357. .round {
  358. width: 32rpx;
  359. height: 32rpx;
  360. line-height: 32rpx;
  361. text-align: center;
  362. border-radius: 50%;
  363. background: $theme-color;
  364. font-size: 24rpx;
  365. font-style: normal;
  366. font-weight: 400;
  367. color: #fff;
  368. }
  369. }
  370. .round {
  371. width: 32rpx;
  372. height: 32rpx;
  373. line-height: 32rpx;
  374. text-align: center;
  375. border-radius: 50%;
  376. background: $theme-color;
  377. font-size: 24rpx;
  378. font-style: normal;
  379. font-weight: 400;
  380. color: #fff;
  381. }
  382. .listBox-con {
  383. width: 650rpx;
  384. font-weight: 400;
  385. }
  386. .listBox-top {
  387. margin-top: 6rpx;
  388. color: #090A0A;
  389. font-size: 28rpx;
  390. font-style: normal;
  391. font-weight: 800;
  392. }
  393. .listBox-bottom {
  394. color: #090A0A;
  395. font-size: 24rpx;
  396. font-style: normal;
  397. flex-wrap: wrap;
  398. .items {
  399. width: calc(50% - 1px);
  400. border-left: 1rpx solid #E3E5E5;
  401. border-right: 1rpx solid #E3E5E5;
  402. border-bottom: 1rpx solid #E3E5E5;
  403. box-sizing: border-box;
  404. word-break: break-all;
  405. text {
  406. display: inline-block;
  407. background: #F7F9FA;
  408. padding: 8rpx 10rpx;
  409. color: #157A2C;
  410. }
  411. &:nth-child(1),
  412. &:nth-child(2) {
  413. border-top: 1rpx solid #E3E5E5;
  414. margin-top: 8rpx;
  415. }
  416. }
  417. }
  418. }
  419. .card_box {
  420. width: 92vw;
  421. padding: 16rpx 32rpx;
  422. box-sizing: border-box;
  423. border-bottom: 2rpx solid #E1E1E1;
  424. .item_box {
  425. margin-top: 10rpx;
  426. .item_one {
  427. width: 100%;
  428. font-size: 26rpx;
  429. font-style: normal;
  430. font-weight: 400;
  431. line-height: 38rpx;
  432. word-wrap: break-word;
  433. }
  434. .gylx {
  435. color: $theme-color;
  436. }
  437. .perce50 {
  438. width: 50%;
  439. }
  440. }
  441. }
  442. .content_num {
  443. display: flex;
  444. align-items: center;
  445. padding: 0 4rpx;
  446. /deep/ .uni-input-input {
  447. border: 2rpx solid #F0F8F2;
  448. background: #F0F8F2;
  449. color: $theme-color;
  450. }
  451. }
  452. </style>