selectTaskMoves.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="pop-container">
  3. <uni-popup ref="popup" type="dialog" >
  4. <uni-popup-dialog
  5. :title="title"
  6. message=""
  7. :duration="2000"
  8. :before-close="true"
  9. @close="handleCancel"
  10. @confirm="handleOk">
  11. <view class="dialog-content">
  12. <view style="height: 200px">
  13. <zb-table
  14. ref="zbTable"
  15. :show-header="true"
  16. :stripe="false"
  17. :columns="column"
  18. :data="data"
  19. :highlight="true"
  20. @currentChange="currentChange"
  21. :border="true"
  22. >
  23. </zb-table>
  24. </view>
  25. </view>
  26. </uni-popup-dialog>
  27. </uni-popup>
  28. </view>
  29. </template>
  30. <script>
  31. import { getDicts } from "@/api/system/dict/data"; // 字典
  32. import { listTaskMoves } from "@/api/wms/stockMove.js";
  33. export default {
  34. props: {
  35. title: {
  36. type: String,
  37. required: true
  38. },
  39. formData:{
  40. type: Object,
  41. require: true
  42. }
  43. },
  44. mounted() {
  45. },
  46. created: function(option) {
  47. },
  48. data() {
  49. return {
  50. currentFlag: '',
  51. keyWord: '', // 输入查询的值
  52. column: [], // 表头数据
  53. data: [], // 表体数据
  54. currentSelectData: {}, //当前选中数据行
  55. };
  56. },
  57. methods:{
  58. handleOk() {
  59. if(Object.keys(this.currentSelectData).length == 0){
  60. uni.showToast({
  61. title: "任务有多行匹配,请选择一行",
  62. icon: "none",
  63. duration: 3000
  64. })
  65. return true;
  66. }
  67. this.$emit("sendData", this.currentSelectData);
  68. // 点击确定按钮的处理逻辑
  69. this.currentSelectData = {}
  70. this.$refs.popup.close()
  71. },
  72. handleCancel() {
  73. uni.showToast({
  74. title: "任务有多行匹配,请选择一行",
  75. icon: "none",
  76. duration: 3000
  77. })
  78. },
  79. hidePopup() {
  80. this.$refs.popup.close();
  81. },
  82. // 单选当前行
  83. currentChange(row,index){
  84. this.currentSelectData = row;
  85. },
  86. // searchBar
  87. input(value) {// uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的 value e=value
  88. this.keyWord = value;
  89. },
  90. clear(res) {
  91. this.keyWord = "";
  92. },
  93. cancel(res) {
  94. this.keyWord = "";
  95. },
  96. // 查询按钮点击事件
  97. search(){
  98. let that = this;
  99. this.getRwbmList();
  100. },
  101. // 获取任务编码数据
  102. async getRwbmList(){
  103. let that = this;
  104. // 出库类型
  105. let inTypeObj = {}
  106. getDicts("out_type").then(response => {
  107. // that.inTypeOption = response.data;
  108. let tmpArr = response.data;
  109. if(tmpArr.length > 0){
  110. tmpArr.forEach((item,index)=>{
  111. inTypeObj[item.dictValue] = item.dictLabel;
  112. })
  113. }
  114. });
  115. // 任务编码表头
  116. this.column = [
  117. { name: 'subTaskCode', label:'任务编号', width:170,align:'center', emptyString:'--' },
  118. { name: 'taskQty', label:'任务数', width:90,align:'center', emptyString:'--'},
  119. { name: 'stockQty', label:'移位数', width:90,align:'center', emptyString:'--'},
  120. ];
  121. let params = {
  122. billTypeCode: that.formData.taskBillTypeCode,
  123. id: that.formData.taskMoveId,
  124. params: {
  125. "materialCode":that.formData.materialCode
  126. },
  127. }
  128. let res = await listTaskMoves(params);
  129. let IsMultipleRow = false;
  130. if(res.code === 200){
  131. that.data = res.rows.map(item => {
  132. let a1 = item.wmsTaskMoves;
  133. let a2 = item;
  134. return Object.assign({}, a2, a1);
  135. });
  136. //大于1行才显示选项
  137. if(that.data.length > 1){
  138. uni.vibrateLong({});
  139. IsMultipleRow = true;
  140. this.$refs.popup.open();
  141. }
  142. }
  143. return IsMultipleRow;
  144. },
  145. },
  146. }
  147. </script>
  148. <style>
  149. @import "@/static/scss/commonpopup.css"
  150. </style>