outsourceList.vue 12 KB

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