index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="sawing-page">
  3. <navigation title="锯断数据"></navigation>
  4. <view class="list-box" v-if="dataList.length>0">
  5. <view class="add" @click="addInfo">
  6. <image class="icon" src="@/static/add.jpg"></image>
  7. <view class="text">新增</view>
  8. </view>
  9. <view class="list-item" v-for="(item, index) in dataList" :key="index">
  10. <view class="item-text">订单编号:{{ item.orderNum || '-' }}</view>
  11. <view class="item-text">下料长度:{{ item.allLength || '-' }}</view>
  12. <view class="item-text">切割长度:{{ item.cuttingLength || '-' }}</view>
  13. <view class="btn-box">
  14. <view class="btn-item" @click="editInfo(item.id)">
  15. <view>修改</view>
  16. </view>
  17. <view class="btn-item" @click="deleteInfo(item.id)">
  18. <view>删除</view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <empty v-else text="暂无数据" :showBtn="true" @onAdd="addInfo"></empty>
  24. <!-- 确认框 -->
  25. <uni-popup ref="alertDialog" type="dialog">
  26. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="提示" content="确认删除吗?"
  27. @confirm="dialogConfirm"></uni-popup-dialog>
  28. </uni-popup>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. dataList: [],
  36. id: '',
  37. }
  38. },
  39. onShow() {
  40. this.getList()
  41. },
  42. methods: {
  43. getList() {
  44. uni.showLoading({
  45. title: '正在加载...'
  46. })
  47. this.$api.mesCuttingList().then(res => {
  48. this.dataList = res.rows
  49. uni.hideLoading()
  50. }).catch(err => {})
  51. },
  52. addInfo() {
  53. uni.navigateTo({
  54. url: '/subPackages/sawing/add'
  55. });
  56. },
  57. // 修改
  58. editInfo(id) {
  59. uni.navigateTo({
  60. url: '/subPackages/sawing/add?id=' + id
  61. });
  62. },
  63. // 删除
  64. deleteInfo(id) {
  65. this.id = id
  66. this.$refs.alertDialog.open()
  67. },
  68. dialogConfirm() {
  69. let that = this
  70. this.$api.delMesCutting(this.id).then(res => {
  71. uni.showToast({
  72. title: '删除成功!',
  73. duration: 2000
  74. });
  75. setTimeout(function() {
  76. that.getList()
  77. }, 2000);
  78. }).catch(err => {})
  79. },
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .sawing-page {
  85. .add {
  86. display: flex;
  87. justify-content: center;
  88. align-items: center;
  89. background-color: #fff;
  90. padding: 20rpx;
  91. border-radius: 16rpx;
  92. .icon {
  93. width: 50rpx;
  94. height: 50rpx;
  95. margin-right: 16rpx;
  96. }
  97. }
  98. .list-box {
  99. padding: 0 20rpx;
  100. color: $uni-text-color-list;
  101. .list-item {
  102. background-color: $uni-bg-color;
  103. padding: 20rpx;
  104. border-radius: 20rpx;
  105. margin-top: 28rpx;
  106. .item-text {
  107. margin-top: 10rpx;
  108. }
  109. }
  110. .btn-box {
  111. display: flex;
  112. justify-content: flex-end;
  113. margin-top: 10rpx;
  114. .btn-item {
  115. width: 175rpx;
  116. height: 50rpx;
  117. line-height: 50rpx;
  118. text-align: center;
  119. border-radius: 24rpx;
  120. margin-left: 20rpx;
  121. border: 1px solid #43adfd;
  122. color: #43adfd;
  123. }
  124. }
  125. }
  126. }
  127. </style>