HandlePop.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <u-popup :show="searchVisible" mode="bottom" @close="searchVisible = false">
  3. <view class="handle-wrapper">
  4. <uni-table border>
  5. <uni-tr>
  6. <uni-td align="center">处置方式</uni-td>
  7. <uni-td align="center">改型</uni-td>
  8. </uni-tr>
  9. <uni-tr>
  10. <uni-td align="center">仓库</uni-td>
  11. <uni-td align="center">
  12. <uni-easyinput
  13. type="text"
  14. @click.native="openWarehouse"
  15. :value="formData.warehouse"
  16. placeholder="请选择"
  17. />
  18. </uni-td>
  19. </uni-tr>
  20. <uni-tr>
  21. <uni-td align="center">数量</uni-td>
  22. <uni-td align="center">
  23. <uni-number-box
  24. v-model="formData.disposeWeight"
  25. :min="0"
  26. :max="Infinity"
  27. >
  28. </uni-number-box>
  29. </uni-td>
  30. </uni-tr>
  31. </uni-table>
  32. <view class="footer">
  33. <button type="default" plain="true" size="mini" @click="cancel">
  34. 取消
  35. </button>
  36. <button type="primary" size="mini" @click="confirm">确认</button>
  37. </view>
  38. </view>
  39. <u-action-sheet
  40. :closeOnClickAction="true"
  41. :actions="warehouseList"
  42. title="选择仓库"
  43. @close="warehouseShow = false"
  44. @select="warehouseSelect"
  45. :show.sync="warehouseShow"
  46. ></u-action-sheet>
  47. </u-popup>
  48. </template>
  49. <script>
  50. import { getByCode } from "@/api/production/extrusion.js";
  51. export default {
  52. data() {
  53. return {
  54. warehouseShow: false,
  55. searchVisible: false,
  56. warehouseList: [],
  57. pickerIndex: 0,
  58. formData: {
  59. warehouseCode: "",
  60. warehouse: "",
  61. disposeWeight: "",
  62. },
  63. callback: null,
  64. };
  65. },
  66. created() {
  67. this.getList();
  68. },
  69. methods: {
  70. openWarehouse() {
  71. this.warehouseShow = true;
  72. },
  73. async getList() {
  74. const data = await getByCode("modificatiWnarehouse");
  75. const list = [];
  76. if (data.length) {
  77. data.map((item, index) => {
  78. for (var key in data[index]) {
  79. list.push({
  80. name: data[index][key],
  81. code: key,
  82. });
  83. }
  84. });
  85. }
  86. this.warehouseList = list;
  87. },
  88. confirm() {
  89. this.$emit("confirm", this.formData);
  90. this.callback && this.callback(this.formData);
  91. this.cancel();
  92. },
  93. cancel() {
  94. this.searchVisible = false;
  95. },
  96. open(disposeType, callback) {
  97. this.searchVisible = true;
  98. this.formData.disposeType = disposeType;
  99. this.callback = callback;
  100. },
  101. warehouseSelect(e) {
  102. this.formData.warehouse = e.name;
  103. this.formData.warehouseCode = e.code;
  104. },
  105. },
  106. };
  107. </script>
  108. <style lang="scss" scoped>
  109. .handle-wrapper {
  110. padding: 20rpx 0;
  111. /deep/.uni-numbox__value {
  112. width: 100%;
  113. }
  114. }
  115. .footer {
  116. padding: 20rpx 0;
  117. display: flex;
  118. justify-content: space-around;
  119. }
  120. </style>