productStore.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="productStore">
  3. <div class="input-number">
  4. <el-input-number v-model="num" @change="handleChange" :min="1" size="small"></el-input-number>
  5. <el-tooltip class="item" effect="dark" content="库存信息" placement="bottom-start">
  6. <div class="icon" @click="value = true">
  7. <i class="el-icon-question"></i>
  8. </div>
  9. </el-tooltip>
  10. </div>
  11. <vxe-modal v-model="value" id="productStoreModal" width="80%" height="80%" @show="show" min-width="460" min-height="320"
  12. show-zoom resize transfer show-footer>
  13. <template #title>
  14. <span>查看库存</span>
  15. </template>
  16. <template #default>
  17. <module-view :propConfig="config" ref="view" @pagination="getList" />
  18. </template>
  19. </vxe-modal>
  20. </div>
  21. </template>
  22. <script lang="ts">
  23. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  24. @Component
  25. export default class ProductStore extends Vue {
  26. num:number=1;
  27. value=false
  28. time:any;
  29. timeNum = 0;
  30. data:Array<any>=[]
  31. config:any={
  32. table:{
  33. attr:{
  34. size:'mini',
  35. seq:true,
  36. align:'center',
  37. checkbox:true
  38. },
  39. columns:[{
  40. title:'名称',
  41. field:'name'
  42. },{
  43. title:'坐标',
  44. field:'coordinate'
  45. },{
  46. title:'地址',
  47. field:'address'
  48. }]
  49. }
  50. }
  51. //显示弹窗
  52. show(){
  53. if(this.data.length ==0){
  54. this.time =setInterval(()=>{
  55. this.getList()
  56. },500)
  57. }
  58. }
  59. getList(){
  60. if(!this.$refs.view){
  61. if(this.timeNum > 5){
  62. clearInterval(this.time)
  63. }
  64. this.timeNum ++;
  65. return
  66. }
  67. clearInterval(this.time)
  68. let query = (this.$refs.view as any).getQuery();
  69. (this as any).$request({
  70. url: '/maindata/maindataStorehouse/page',
  71. method: 'get',
  72. params:query
  73. }).then((res:any) => {
  74. if(res.data.records){
  75. (this.$refs.view as any).setTableValue(res.data.records);
  76. this.data = res.data.records;
  77. let page={
  78. pageNo: res.data.current, //当前页
  79. pageSize: res.data.size, //每页条数
  80. total: res.data.total //总条数
  81. };
  82. (this.$refs.view as any).setPage(page)
  83. }
  84. })
  85. }
  86. handleChange(v:number){
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .input-number{
  92. min-width: 200px;
  93. display: flex;
  94. align-items: center;
  95. .icon{
  96. cursor: pointer;
  97. margin-left: 8px;
  98. }
  99. .el-icon-question{
  100. color: #666;
  101. }
  102. }
  103. </style>