DetailList.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <van-popup
  3. v-model:show="props.visibleDetail"
  4. closeable
  5. @close="props.close()"
  6. position="bottom"
  7. :style="{ height: '80%' }">
  8. <view
  9. class="content-wrap"
  10. style="margin-top: 80rpx">
  11. <view class="exe-item">
  12. <Detailtem :data="props.detailData" />
  13. </view>
  14. <view class="exe-item">
  15. <view class="exe-item-detli-top">
  16. <uni-datetime-picker
  17. class="exe-item-detli-time"
  18. type="date"
  19. :model-value="exeDate"
  20. @change="(e) => onConfirm(e)"
  21. :hide-second="true"
  22. :border="false"
  23. />
  24. <view class="item-right-li priamry"> {{showNum}} </view>
  25. </view>
  26. <van-row class="table-item header">
  27. <van-col span="8">要求执行时间</van-col>
  28. <van-col span="7">执行时间</van-col>
  29. <van-col span="4">执行人</van-col>
  30. <van-col span="5">执行状态</van-col>
  31. </van-row>
  32. <view
  33. v-for="(item, index) in newExecInfos">
  34. <van-row class="table-item">
  35. <van-col span="8">{{item?.execSttTime}}</van-col>
  36. <van-col span="7">{{item?.execTime}}</van-col>
  37. <van-col span="4">{{item?.execUserName}}</van-col>
  38. <van-col span="5">{{item?.statusDesc}}</van-col>
  39. </van-row>
  40. </view>
  41. </view>
  42. </view>
  43. </van-popup>
  44. </template>
  45. <script setup>
  46. import { ref, watch, onMounted, nextTick } from 'vue';
  47. import { $http } from '../../../config/https';
  48. import Detailtem from './Detailtem.vue';
  49. const exeDate = ref(''); // 执行日期
  50. const showNum = ref('');
  51. const newExecInfos = ref([]);
  52. const props = defineProps({
  53. visibleDetail: {
  54. type: Boolean,
  55. default: false,
  56. },
  57. detailData: {
  58. type: String,
  59. default: '',
  60. },
  61. close: {
  62. type: Function,
  63. default: () => {},
  64. },
  65. });
  66. const formatDateTime = () => {
  67. const date = new Date();
  68. return `${date.getFullYear()}-${(date.getMonth()+1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
  69. };
  70. //初始化
  71. const initData = () =>{
  72. $http.post('urlDeault',this, {
  73. code: '04220027',
  74. data: {
  75. params: [{
  76. "ordID": props.detailData.ordID,
  77. "exeDate": exeDate.value
  78. }]
  79. },
  80. success: function(res) {
  81. if (+res.errorCode === 0) {
  82. newExecInfos.value = res.result;
  83. // 计算已执行数量和总数量,生成showNum
  84. const totalExecCount = Array.isArray(res.result) ? res.result.length : 0;
  85. const executedCount = Array.isArray(res.result)
  86. ? res.result.filter(exec => exec.statusDesc === '已执行').length
  87. : 0;
  88. showNum.value = `${executedCount}/${totalExecCount}`;
  89. }
  90. },
  91. });
  92. }
  93. // 确定选择日期
  94. const onConfirm = (value) => {
  95. exeDate.value = value;
  96. initData();
  97. };
  98. watch(
  99. () => props.detailData,
  100. (newVal) => {
  101. if(props.detailData && props.detailData?.ordID){
  102. let exeDateNow = formatDateTime();
  103. exeDate.value = exeDateNow;
  104. initData();
  105. }
  106. },
  107. { immediate: true, deep: true },
  108. );
  109. </script>
  110. <style scoped>
  111. @import url(../common.css);
  112. .table-item {
  113. padding: 20rpx;
  114. border-bottom: 2rpx solid #eee;
  115. font-size: 24rpx;
  116. color: #666;
  117. }
  118. .table-item.header {
  119. color: #333;
  120. }
  121. .table-item:last-child {
  122. border-bottom: none;
  123. }
  124. </style>