outsourceList.vue 12 KB

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