outsourceList.vue 12 KB

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