index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="搜索" @clickLeft="back">
  4. </uni-nav-bar>
  5. <view class="top-wrapper">
  6. <view class="searchBox rx-bc">
  7. <zxz-uni-data-select :localdata="taskList" v-model="formData.taskId" dataValue='id' format='{name}'
  8. dataKey="name" filterable placeholder="请选择工序" @change="doSearch"></zxz-uni-data-select>
  9. <u-button @click="doSearch" type="success" size="small" class="u-reset-button" text="搜索">
  10. </u-button>
  11. </view>
  12. </view>
  13. <view class="list_box">
  14. <u-list @scrolltolower="scrolltolower">
  15. <checkbox-group v-for="(item, index) in list" :key="index" @change="e => selectVal(e, item, index)">
  16. <label class="listBox rx-bs">
  17. <view class="listBox-sel">
  18. <checkbox
  19. v-if='item.rootCategoryLevelId != 11 || (item.rootCategoryLevelId == 11 && item.status != 1)'
  20. :value="item.code" color="#fff" :disabled="item.disabled" :checked="item.checked" />
  21. </view>
  22. <view class="listBox-con">
  23. <view class="listBox-top rx-bc">
  24. <view>工单编号:</view>
  25. <view class="code">{{ item.code}}</view>
  26. </view>
  27. <view class="listBox-bottom rx">
  28. <view class="items">
  29. <text>工艺路线</text>{{ item.produceRoutingName }}
  30. </view>
  31. <view class="items">
  32. <text>名称</text>{{ item.productName }}
  33. </view>
  34. <view class="items">
  35. <text>生产数量</text>{{ item.formingNum }}{{item.unit}}
  36. </view>
  37. <view class="items">
  38. <text>生产重量</text>{{item.formingWeight}} {{item.weightUnit}}
  39. </view>
  40. </view>
  41. </view>
  42. </label>
  43. </checkbox-group>
  44. <view v-if='list.length == 0' style='margin-top: 20vh;'>
  45. <u-empty iconSize='150' textSize='32' text='暂无数据'>
  46. </u-empty>
  47. </view>
  48. </u-list>
  49. </view>
  50. <view class="bottom-wrapper rx-bc">
  51. <view>
  52. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  53. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  54. </checkbox>
  55. </view>
  56. <view>
  57. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen"
  58. @click="handleSelect">
  59. <view> 选择( {{ checkListLen }} ) </view>
  60. </u-button>
  61. </view>
  62. </view>
  63. <SearchPopup mode="center" v-if='searchShow'>
  64. <template v-slot:list>
  65. <u-list @scrolltolower="scrolltolower" class="wl_list">
  66. <view class="recycleTitle">副产品列表</view>
  67. <view class="pop_list" v-for="(item, index) in memoList" :key="index">
  68. <view class="work_box rx-bc">
  69. <view>工单编号:</view>
  70. <view class="code">{{item.code}}</view>
  71. </view>
  72. <view class="recycleList rx" v-for="(it,idx) in item.recycleList" :key="'RECY' + idx">
  73. <view class="items">
  74. <text>副产品{{idx+1}}</text>{{ it.categoryName }}
  75. </view>
  76. <view class="items">
  77. <text>编号</text>{{ it.categoryCode }}
  78. </view>
  79. </view>
  80. </view>
  81. <view class="recycleTitle mt40">副产品处置</view>
  82. <view class="content_table" v-for="(item, index) in recyclell" :key="'ll' +index">
  83. <view class="item rx-sc">
  84. <view class="rx ww55 ">
  85. <view class="lable rx-cc">副产品</view>
  86. <view class="content ">{{item.categoryName}}</view>
  87. </view>
  88. <view class="rx ww45">
  89. <view class="lable rx-cc ww80">编号</view>
  90. <view class="content ">
  91. {{item.categoryCode}}
  92. </view>
  93. </view>
  94. </view>
  95. <view class="item rx-sc">
  96. <view class="rx ww55 ">
  97. <view class="lable rx-cc">处置</view>
  98. <view class="content content_num">
  99. <zxz-uni-data-select :localdata="warehouseList" v-model="item.warehouseId"
  100. dataValue='id' format='{name}' dataKey="name" filterable
  101. :clear='false'></zxz-uni-data-select>
  102. </view>
  103. </view>
  104. <view class="rx ww45">
  105. <view class="lable rx-cc ww80">数量</view>
  106. <view class="content content_num">
  107. <input class="uni-input" v-model="item.quantity" type="digit"></input>
  108. <view class="unit">{{item.weightUnit}}</view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </u-list>
  114. </template>
  115. <template v-slot:operate>
  116. <view class="operate_box rx-bc">
  117. <u-button size="small" class="u-reset-button" @click="searchCancel">
  118. 取消
  119. </u-button>
  120. <u-button type="success" size="small" class="u-reset-button" @click="handSave">
  121. 确定
  122. </u-button>
  123. </view>
  124. </template>
  125. </SearchPopup>
  126. </view>
  127. </template>
  128. <script>
  129. import {
  130. tableHeader
  131. } from '../../common.js'
  132. import {
  133. treeByPid,
  134. listWorkOrderByTaskId,
  135. getWarehouseList,
  136. disposeorder
  137. } from '@/api/pda/workOrder.js'
  138. import {
  139. producetaskList
  140. } from '@/api/common.js'
  141. import SearchPopup from '../../components/searchPopup.vue'
  142. let [isEnd] = [false]
  143. export default {
  144. components: {
  145. SearchPopup
  146. },
  147. data() {
  148. return {
  149. list: [],
  150. page: 1,
  151. seletedAll: false, //全选状态
  152. memoList: [],
  153. recyclell: [],
  154. formData: {
  155. taskId: '',
  156. },
  157. taskList: [],
  158. warehouseList: [],
  159. searchShow: false,
  160. }
  161. },
  162. //选择的列表长度
  163. computed: {
  164. checkListLen() {
  165. return this.memoList.length
  166. }
  167. },
  168. onLoad(option) {
  169. this.getProducetask()
  170. this.getWarehouseFn()
  171. },
  172. onUnload() {
  173. },
  174. methods: {
  175. _seletedAll() {
  176. if (!this.seletedAll) {
  177. this.seletedAll = true
  178. this.list.map(item => {
  179. this.$set(item, 'checked', true)
  180. const idx = this.memoList.findIndex(itm => itm.id === item.id)
  181. if (idx === -1) {
  182. this.memoList.push(item)
  183. }
  184. })
  185. } else {
  186. this.seletedAll = false
  187. this.list.map(item => {
  188. this.$set(item, 'checked', false)
  189. const idx = this.memoList.findIndex(itm => itm.id === item.id)
  190. if (idx > -1) {
  191. this.memoList.splice(idx, 1)
  192. }
  193. })
  194. }
  195. },
  196. doSearch() {
  197. this.list = []
  198. this.getList()
  199. },
  200. scrolltolower() {
  201. if (isEnd) return
  202. this.page++
  203. this.getList()
  204. },
  205. getList() {
  206. let param = {
  207. pageNum: this.page,
  208. size: 10,
  209. taskId: this.formData.taskId,
  210. }
  211. listWorkOrderByTaskId(param).then(res => {
  212. this.list = res.list
  213. })
  214. },
  215. //勾选
  216. selectVal(e, val, index) {
  217. console.log(val)
  218. if (val.rootCategoryLevelId == 11 && val.status == 1) {
  219. return false
  220. }
  221. this.list[index].checked = !this.list[index].checked
  222. this.seletedAll = !this.list.some(item => !item.checked)
  223. const idx = this.memoList.findIndex(
  224. item => item.id === this.list[index].id
  225. )
  226. if (this.list[index].checked) {
  227. if (idx === -1) {
  228. this.memoList.push(this.list[index])
  229. }
  230. } else {
  231. if (idx > -1) {
  232. this.memoList.splice(idx, 1)
  233. }
  234. }
  235. },
  236. searchCancel() {
  237. this.list = []
  238. this.page = 1
  239. this.getList()
  240. this.searchShow = false
  241. },
  242. handleSelect() {
  243. let arr = []
  244. this.recyclell = []
  245. this.memoList.forEach(e => {
  246. e.recycleList.forEach(f => {
  247. arr.push(f)
  248. })
  249. })
  250. this.recyclell = Array.from(new Set(arr.map(item => JSON.stringify(item)))).map(item => JSON.parse(item))
  251. this.searchShow = true
  252. },
  253. handSave() {
  254. let param = {
  255. taskId: this.formData.taskId,
  256. recyclell: this.recyclell,
  257. memoList: this.memoList
  258. }
  259. disposeorder(param).then(res => {
  260. console.log(res)
  261. this.searchShow = false
  262. })
  263. },
  264. getProducetask() {
  265. producetaskList().then(res => {
  266. this.taskList = res
  267. })
  268. },
  269. getWarehouseFn() {
  270. getWarehouseList().then(res => {
  271. this.warehouseList = res
  272. })
  273. },
  274. }
  275. }
  276. </script>
  277. <style lang="scss" scoped>
  278. .content-box {
  279. height: 100vh;
  280. overflow: hidden;
  281. display: flex;
  282. flex-direction: column;
  283. background-color: $page-bg;
  284. }
  285. .searchBox {
  286. background-color: #dedede;
  287. height: 90rpx;
  288. padding: 0 20rpx;
  289. .mt20 {
  290. margin-top: 20rpx;
  291. }
  292. /deep/ .uni-select {
  293. height: 70rpx;
  294. width: 520rpx;
  295. background: #fff !important;
  296. padding-left: 10rpx;
  297. border-radius: 5rpx;
  298. margin-right: 20rpx;
  299. }
  300. }
  301. .list_box {
  302. flex: 1;
  303. overflow: hidden;
  304. padding: 6rpx 0;
  305. .u-list {
  306. height: 100% !important;
  307. }
  308. }
  309. .bottom-wrapper {
  310. height: 80rpx;
  311. background: #fff;
  312. padding: 0 32rpx;
  313. /deep/ .uni-checkbox-input-checked {
  314. background-color: $theme-color !important;
  315. border-color: $theme-color !important;
  316. }
  317. }
  318. .listBox {
  319. margin-top: 8rpx;
  320. padding: 8rpx 24rpx;
  321. background: #fff;
  322. /deep/ .uni-checkbox-input-checked {
  323. background-color: $theme-color !important;
  324. border-color: $theme-color !important;
  325. }
  326. .listBox-con {
  327. width: 650rpx;
  328. font-weight: 400;
  329. }
  330. .listBox-top {
  331. margin-top: 6rpx;
  332. color: #090A0A;
  333. font-size: 28rpx;
  334. font-style: normal;
  335. font-weight: 800;
  336. }
  337. }
  338. .listBox-bottom,
  339. .recycleList {
  340. color: #090A0A;
  341. font-size: 24rpx;
  342. font-style: normal;
  343. flex-wrap: wrap;
  344. .items {
  345. width: calc(50% - 1px);
  346. border-left: 1rpx solid #E3E5E5;
  347. border-right: 1rpx solid #E3E5E5;
  348. border-bottom: 1rpx solid #E3E5E5;
  349. box-sizing: border-box;
  350. word-break: break-all;
  351. text {
  352. display: inline-block;
  353. background: #F7F9FA;
  354. padding: 8rpx 10rpx;
  355. color: #157A2C;
  356. }
  357. &:nth-child(1),
  358. &:nth-child(2) {
  359. border-top: 1rpx solid #E3E5E5;
  360. margin-top: 8rpx;
  361. }
  362. }
  363. }
  364. .wl_list {
  365. width: 720rpx;
  366. max-height: 75vh;
  367. .operate_box {
  368. margin: 20rpx;
  369. }
  370. .recycleTitle {
  371. margin-top: 12rpx;
  372. font-size: 28rpx;
  373. line-height: 24rpx;
  374. border-left: 6rpx solid #157A2C;
  375. padding-left: 16rpx;
  376. color: #157A2C;
  377. margin-left: 16rpx;
  378. }
  379. .mt40 {
  380. margin-top: 40rpx;
  381. }
  382. .pop_list {
  383. padding: 12rpx 16rpx;
  384. border-bottom: 2rpx solid #157A2C;
  385. .work_box {
  386. color: #090A0A;
  387. font-size: 28rpx;
  388. font-style: normal;
  389. font-weight: 800;
  390. }
  391. .recycleList {
  392. .lable {
  393. width: 32rpx;
  394. height: 32rpx;
  395. line-height: 32rpx;
  396. text-align: center;
  397. border-radius: 50%;
  398. background: #157A2C;
  399. font-size: 20rpx;
  400. color: #fff;
  401. margin-right: 40rpx;
  402. }
  403. }
  404. .it_name {
  405. width: 350rpx;
  406. font-size: 24rpx;
  407. }
  408. .it_code {
  409. font-size: 24rpx;
  410. }
  411. }
  412. }
  413. .content_table {
  414. width: 700rpx;
  415. margin: auto;
  416. margin-top: 20rpx;
  417. border: 2rpx solid $border-color;
  418. .item {
  419. display: flex;
  420. border-bottom: 2rpx solid $border-color;
  421. .lable {
  422. width: 100rpx;
  423. text-align: center;
  424. background-color: #F7F9FA;
  425. font-size: 22rpx;
  426. border-right: 2rpx solid $border-color;
  427. flex-shrink: 0;
  428. }
  429. .ww80 {
  430. width: 60rpx;
  431. }
  432. .content {
  433. width: 518rpx;
  434. min-height: 64rpx;
  435. font-size: 24rpx;
  436. line-height: 28rpx;
  437. font-style: normal;
  438. font-weight: 400;
  439. padding: 18rpx 8rpx;
  440. box-sizing: border-box;
  441. word-wrap: break-word;
  442. flex-grow: 1 !important;
  443. }
  444. .content_num {
  445. display: flex;
  446. align-items: center;
  447. padding: 0 4rpx;
  448. /deep/ .uni-input-input {
  449. border: 2rpx solid #F0F8F2;
  450. background: #F0F8F2;
  451. color: $theme-color;
  452. }
  453. .unit {
  454. width: 90rpx;
  455. text-align: center;
  456. font-size: 24rpx;
  457. color: #404446;
  458. }
  459. }
  460. .pd4 {
  461. padding: 4rpx 8rpx;
  462. }
  463. &:last-child {
  464. border-bottom: none;
  465. }
  466. }
  467. .ww55 {
  468. width: 55%;
  469. }
  470. .ww45 {
  471. width: 45%;
  472. }
  473. }
  474. </style>