outsourceList.vue 13 KB

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