workInProgressList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view class="container">
  3. <view class="d-table">
  4. <!-- type="selection" @selection-change="selectionChange" -->
  5. <uni-table border stripe emptyText="暂无更多数据">
  6. <!-- 表头行 -->
  7. <uni-tr>
  8. <!-- <uni-th align="center"> -->
  9. <!-- <checkbox-group @change="handlerChecked">
  10. <checkbox :checked="isAllChecked" value="1" />
  11. </checkbox-group> -->
  12. <!-- </uni-th> -->
  13. <uni-th align="center">序号</uni-th>
  14. <uni-th align="center">批次号</uni-th>
  15. <uni-th align="center">名称</uni-th>
  16. <uni-th align="center">牌号</uni-th>
  17. <uni-th align="center">型号</uni-th>
  18. <uni-th align="center">数量</uni-th>
  19. <uni-th align="center">投料数量</uni-th>
  20. <uni-th align="center">重量</uni-th>
  21. <uni-th align="center">是否合格</uni-th>
  22. <uni-th align="center">操作</uni-th>
  23. </uni-tr>
  24. <!-- 表格数据行 -->
  25. <uni-tr v-for="(item, index) in itemData" :key="index">
  26. <!-- <uni-td>
  27. <checkbox-group @change="handlerCheckedTow($event, index, item)">
  28. <checkbox :checked="item.selected" value="1" />
  29. </checkbox-group>
  30. </uni-td> -->
  31. <uni-td>{{ index + 1 }}</uni-td>
  32. <uni-td>
  33. <input class="uni-input" v-model="item.batchNo"></input>
  34. </uni-td>
  35. <uni-td>
  36. {{ item.name + '-在制品' }}
  37. </uni-td>
  38. <uni-td>
  39. {{ item.brandNu }}
  40. </uni-td>
  41. <uni-td>
  42. {{ item.modelType }}
  43. </uni-td>
  44. <uni-td>
  45. {{ item.extInfo.sourceQuantity || 0 }}{{ item.unit }}
  46. </uni-td>
  47. <uni-td>
  48. {{ item.extInfo.newWeight || 0 }}{{ item.extInfo.weightUnit }}
  49. </uni-td>
  50. <uni-td>
  51. <u-button>拆批</u-button>
  52. <u-button>删除</u-button>
  53. </uni-td>
  54. </uni-tr>
  55. </uni-table>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. props: {
  62. tableData: {
  63. type: Array,
  64. default: () => []
  65. },
  66. itemData: {
  67. type: Object,
  68. default: () => { }
  69. },
  70. },
  71. data() {
  72. return {
  73. pickerIndex: 0,
  74. isAllChecked: true,
  75. listArr: [],
  76. selectedIndexs: []
  77. };
  78. },
  79. watch:{
  80. tableData:{
  81. handler(v){
  82. this.listArr =v;
  83. },
  84. immediate:true,
  85. deep:true
  86. }
  87. },
  88. methods: {
  89. handlerCheckedTow(e, index, item) {
  90. console.log(item);
  91. if (e.detail.value.length) {
  92. // this.$set(this.tableData[index], 'selected', true);
  93. item.selected = true;
  94. } else {
  95. // this.$set(this.tableData[index], 'selected', false);
  96. item.selected = false;
  97. }
  98. this.listArr[index] =item;
  99. // this.$emit('tableDataFn', this.tableData);
  100. console.log(this.tableData);
  101. this.$nextTick(() => {
  102. let a = this.listArr.filter(v => v.selected);
  103. if (a.length && a.length == this.listArr.length) {
  104. this.isAllChecked = true;
  105. } else {
  106. this.isAllChecked = false;
  107. }
  108. })
  109. },
  110. //全选
  111. handlerChecked(e) {
  112. console.log(this.listArr);
  113. if (e.detail.value.length) {
  114. // 全选
  115. this.listArr.map(item => {
  116. item.selected = true;
  117. })
  118. } else {
  119. // 未选中
  120. this.listArr.map(item => {
  121. item.selected = false;
  122. })
  123. }
  124. this.listArr = [];
  125. this.$set(this, 'listArr', this.listArr);
  126. this.listArr = this.tableData;
  127. this.$emit('tableDataFn', this.tableData);
  128. },
  129. blurNum(workReportInfo) {
  130. this.$emit('tableDataFn', this.tableData);
  131. },
  132. handlerChange(item, index) {
  133. // this.$emit('tableDataFn', this.tableData);
  134. console.log(item, index);
  135. },
  136. selectionChange(e) {
  137. this.selectedIndexs = e.detail.index;
  138. },
  139. }
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. ::v-deep .uni-select--mask{
  144. position: relative !important;
  145. }
  146. .container {
  147. padding: 10rpx;
  148. overflow: auto;
  149. checkbox {
  150. transform: scale(0.8);
  151. }
  152. }
  153. .uni-input {
  154. width: 150rpx;
  155. border: 1px solid #F0F8F2;
  156. background: #F0F8F2;
  157. color: #157A2C;
  158. }
  159. /deep/.uni-table {
  160. min-width: 100vw !important;
  161. .uni-table-td,
  162. .uni-table-th {
  163. padding: 20rpx 10rpx !important;
  164. text-align: center !important;
  165. font-weight: normal !important;
  166. font-size: 26rpx !important;
  167. }
  168. .uni-table-text {
  169. font-size: 26rpx !important;
  170. }
  171. }
  172. </style>