commonpopup.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 class="header-container">
  13. <uni-row class="demo-uni-row">
  14. <uni-col :span="5" style="padding-left: 10px;text-align: center" >
  15. <view class="gjz-title">关键字</view>
  16. </uni-col>
  17. <uni-col :span="19">
  18. <uni-search-bar
  19. v-model="keyWord"
  20. @input="input"
  21. @cancel="cancel"
  22. @clear="clear"
  23. cancelButton="none"
  24. />
  25. </uni-col>
  26. </uni-row>
  27. <uni-row class="demo-uni-row">
  28. <uni-col :span="24" style="text-align: center;">
  29. <button class="mini-btn" type="primary" size="mini" @click="search">查询</button>
  30. </uni-col>
  31. </uni-row>
  32. </view>
  33. <view style="height: 200px">
  34. <zb-table
  35. ref="zbTable"
  36. :show-header="true"
  37. :stripe="false"
  38. :columns="column"
  39. :data="data"
  40. :highlight="true"
  41. @currentChange="currentChange"
  42. :border="true"
  43. >
  44. </zb-table>
  45. </view>
  46. </view>
  47. <!-- <view slot="footer">
  48. <button type="primary" @click="handleOk">确定</button>
  49. <button @click="handleCancel">取消</button>
  50. </view> -->
  51. </uni-popup-dialog>
  52. </uni-popup>
  53. </view>
  54. </template>
  55. <script>
  56. import { getDicts } from "@/api/system/dict/data"; // 字典
  57. import { listWarehouse } from "@/api/wms/report.js";
  58. export default {
  59. props: {
  60. title: {
  61. type: String,
  62. required: true
  63. },
  64. idxFlag:{
  65. type: String,
  66. required: true
  67. },
  68. formData:{
  69. type: Object,
  70. require: true
  71. }
  72. },
  73. mounted() {
  74. },
  75. created: function(option) {
  76. },
  77. data() {
  78. return {
  79. currentFlag: '',
  80. keyWord: '', // 输入查询的值
  81. column: [], // 表头数据
  82. data: [], // 表体数据
  83. currentSelectData: {}, //当前选中数据行
  84. };
  85. },
  86. methods:{
  87. handleOk() {
  88. let returnData = {
  89. currentFlag: this.currentFlag,
  90. selectData: this.currentSelectData
  91. }
  92. this.$emit("sendData", returnData);
  93. // 点击确定按钮的处理逻辑
  94. this.currentSelectData = {}
  95. this.$refs.popup.close()
  96. },
  97. handleCancel() {
  98. // 点击取消按钮的处理逻辑
  99. this.$refs.popup.close()
  100. },
  101. showPopup() {
  102. // 传递的哪个跳转标志位
  103. this.currentFlag = this.idxFlag;
  104. let that = this;
  105. let cFlag = that.idxFlag;
  106. switch (cFlag){
  107. case "ware": // 仓库
  108. // 部门表头
  109. that.column = [
  110. { name: 'warehouseCode', label:'仓库编码', width:120,align:'center', emptyString:'--' },
  111. { name: 'warehouseName', label:'仓库名称', width:100,align:'center', emptyString:'--'},
  112. ];
  113. that.getWareList();
  114. break;
  115. default:
  116. break;
  117. }
  118. },
  119. hidePopup() {
  120. this.$refs.popup.close();
  121. },
  122. // 单选当前行
  123. currentChange(row,index){
  124. this.currentSelectData = row;
  125. },
  126. // searchBar
  127. input(value) {// uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的 value e=value
  128. this.keyWord = value;
  129. },
  130. clear(res) {
  131. this.keyWord = "";
  132. },
  133. cancel(res) {
  134. this.keyWord = "";
  135. },
  136. // 查询按钮点击事件
  137. search(){
  138. let that = this;
  139. let cFlag = that.currentFlag;
  140. switch (cFlag){
  141. case "ware": // 任务编码
  142. this.getCkList();
  143. break;
  144. default:
  145. break;
  146. }
  147. },
  148. // 获取部门数据
  149. getWareList(){
  150. let that = this;
  151. let params = {
  152. status: '0', //(固定)
  153. params: {
  154. "keyWord":that.keyWord,
  155. "limit":50
  156. },
  157. }
  158. listWarehouse(params).then(res => {
  159. console.log(res)
  160. if(res.code === 200){
  161. that.data = res.rows;
  162. this.$refs.popup.open();
  163. }
  164. });
  165. },
  166. },
  167. }
  168. </script>
  169. <style>
  170. @import "@/static/scss/commonpopup.css"
  171. </style>