outsourceList.vue 11 KB

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