GetRelationMaterialList.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view>
  3. <uni-list>
  4. <uni-list-item>
  5. <view slot="body" class="slot-box">
  6. <view class="row">
  7. <view class="column-left">当前检查项:</view>
  8. <view class="column-right section-title">{{listData.entity!=null?listData.entity.projectName:""}}</view>
  9. </view>
  10. </view>
  11. </uni-list-item>
  12. </uni-list>
  13. <uni-list>
  14. <uni-list-item v-for="(item, index) in listData.list" :key="index" >
  15. <view slot="body" class="slot-box">
  16. <view class="row">
  17. <view class="column-left">编号:</view>
  18. <view class="column-right section-title">{{item.id}}</view>
  19. </view>
  20. <view class="row">
  21. <view class="column-left">材料名:</view>
  22. <view class="column-right">{{item.materialName}}</view>
  23. </view>
  24. <view class="row">
  25. <view class="column-left">单位:</view>
  26. <view class="column-right">{{item.unit}}</view>
  27. </view>
  28. <view class="row">
  29. <view class="column-left">操作:</view>
  30. <view class="column-right"><a href="javascript:;" @click="deleteMaterial(item.id)"><i class="fa fa-times" aria-hidden="true"></i></a></view>
  31. </view>
  32. </view>
  33. </uni-list-item>
  34. </uni-list>
  35. <view style="bottom: 15px;right:10px;position: fixed;z-index: 50;">
  36. <router-link :to="'/pages/template/relationMaterialAdd/relationMaterialAdd?SafeQualityCheckCode=' + this.$util.getQuery('id')" style="text-decoration: none;" title="材料添加">
  37. <uni-icons type="plus-filled" size="80" color="#5678FE"></uni-icons>
  38. </router-link>
  39. </view>
  40. <page-foot :isShow="true" :showIndex="2"></page-foot>
  41. <uni-load-more :status="status" :icon-size="16" :content-text="contentText" />
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. GetZRelationSafeQualityCheckMaterialDTOs,DeleteZRelationSafeQualityCheckMaterial
  47. } from "@/common/api/SafeQualityCheckApi.js";
  48. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  49. export default {
  50. components: {
  51. uniLoadMore
  52. },
  53. data() {
  54. return {
  55. listData: [],
  56. last_id: '',
  57. reload: false,
  58. status: 'more',
  59. contentText: {
  60. contentdown: '上拉加载更多',
  61. contentrefresh: '加载中',
  62. contentnomore: '没有更多'
  63. }
  64. };
  65. },
  66. onLoad() {
  67. console.info("当前登录状态:" + this.$store.state.isLogin);
  68. //console.info(this);
  69. this.$util.persistLogin(this);
  70. },
  71. onPullDownRefresh() {
  72. this.reload = true;
  73. this.last_id = '';
  74. this.getList();
  75. },
  76. onReachBottom() {
  77. this.status = 'more';
  78. this.getList();
  79. },
  80. created: function() {
  81. this.getList();
  82. },
  83. methods: {
  84. getList() {
  85. let that = this;
  86. let id = that.$util.getQuery("id");
  87. GetZRelationSafeQualityCheckMaterialDTOs(id).then((res) => {
  88. console.info('GetZRelationSafeQualityCheckMaterialDTOs',res);
  89. that.listData=res;
  90. console.info(that.listData);
  91. });
  92. },
  93. // 删除材料
  94. deleteMaterial:function(id){
  95. let that = this;
  96. uni.showModal({
  97. title:'提示',
  98. content:'确定要删除吗,删除后不能恢复!',
  99. success: function (res) {
  100. if (res.confirm) {
  101. console.log('用户点击确定');
  102. //删除操作
  103. DeleteZRelationSafeQualityCheckMaterial(id).then((res)=>{
  104. console.info('DeleteZRelationSafeQualityCheckMaterial',res);
  105. if(res>0){
  106. uni.showToast({
  107. title:'删除成功',
  108. duration:3000,
  109. icon:'none'
  110. });
  111. let thisid = that.$util.getQuery("id");
  112. //重新加载数据,以实现刷新
  113. GetZRelationSafeQualityCheckMaterialDTOs(thisid).then((res) => {
  114. console.info('GetZRelationSafeQualityCheckMaterialDTOs',res);
  115. that.listData=res;
  116. console.info(that.listData);
  117. });
  118. }
  119. else{
  120. uni.showToast({
  121. title:'删除失败',
  122. duration:3000,
  123. icon:'none'
  124. });
  125. }
  126. });
  127. } else if (res.cancel) {
  128. console.log('用户点击取消');
  129. }
  130. }
  131. })
  132. }
  133. }
  134. };
  135. </script>
  136. <style scoped lang="scss">
  137. .uni-list-item{
  138. border-bottom: $BgColorBlue;
  139. }
  140. </style>