YearReport.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <div class="reportCard">
  3. <el-form-item label="推送时间:" required>
  4. <el-form-item
  5. prop="monthAndDayList[0]"
  6. :rules="{ required: true, message: '请选择时间', trigger: 'change', }"
  7. >
  8. <el-col :span="22">
  9. <el-cascader
  10. v-model="prop.form.monthAndDayList"
  11. :options="yearArray"
  12. @change="handleChange"
  13. placeholder="每年1月1日"
  14. style="width: 145.5px;"
  15. :disabled="disableType.contentDisable"
  16. />
  17. </el-col>
  18. </el-form-item>
  19. <el-col class="text-center" :span="2">
  20. <span class="text-gray-500">-</span>
  21. </el-col>
  22. <el-form-item
  23. prop="pushTimeList[0]"
  24. :rules="{ required: true, message: '请选择时间', trigger: 'blur' }"
  25. >
  26. <el-col :span="22">
  27. <el-time-picker
  28. v-model="prop.form.pushTimeList[0]"
  29. placeholder="09:00"
  30. value-format="HH:mm:ss"
  31. style="width: 126.5px; height: 32px;"
  32. :disabled="disableType.contentDisable"
  33. />
  34. </el-col>
  35. </el-form-item>
  36. </el-form-item>
  37. <el-form-item label="推送对象:" required prop="recipientType">
  38. <el-radio-group
  39. v-model="prop.form.recipientType"
  40. :disabled="disableType.contentDisable"
  41. >
  42. <el-radio :value="1">全员</el-radio>
  43. <el-radio :value="2">分组</el-radio>
  44. <el-radio :value="3">自定义</el-radio>
  45. </el-radio-group>
  46. </el-form-item>
  47. <el-form-item
  48. v-if="prop.form.recipientType === 2"
  49. label="选择分组:"
  50. required
  51. prop="userGroupList"
  52. >
  53. <el-col :span="10">
  54. <el-select
  55. v-model="prop.form.userGroupList"
  56. multiple
  57. placeholder="请选择分组"
  58. style="width: 240px"
  59. :disabled="disableType.contentDisable"
  60. >
  61. <el-option
  62. v-for="item in options"
  63. :key="item.userGroupId"
  64. :label="item.name"
  65. :value="item.userGroupId"
  66. />
  67. </el-select>
  68. </el-col>
  69. </el-form-item>
  70. <el-form-item
  71. v-if="form.recipientType === 3"
  72. label="选择人员:"
  73. required
  74. prop="customUserList.value"
  75. :rules="{ required: true, message: '请选择推送人员', trigger: ['change'] }"
  76. >
  77. <el-col :span="18">
  78. <SelectTree :form="form" :disableType="disableType"/>
  79. </el-col>
  80. </el-form-item>
  81. </div>
  82. </template>
  83. <script lang="ts" setup>
  84. import { ref, onMounted, } from 'vue';
  85. import { searchGroup } from '@/api/sendMessage/sendMessage';
  86. import SelectTree from '../SelectTree.vue';
  87. const prop = defineProps(['form', 'disableType'])
  88. const options = ref()
  89. const handleChange = () => {
  90. if (prop.form.monthList.length === 0){
  91. prop.form.monthList.push(prop.form.monthAndDayList[0])
  92. prop.form.dayOfMonthList.push(prop.form.monthAndDayList[1])
  93. }
  94. else{
  95. if (prop.form.statisticType != 3){ // 非季报
  96. prop.form.monthList.length = 0
  97. prop.form.monthList.push(prop.form.monthAndDayList[0])
  98. prop.form.dayOfMonthList.length = 0
  99. prop.form.dayOfMonthList.push(prop.form.monthAndDayList[1])
  100. }
  101. }
  102. }
  103. // 默认每年2月都是29天,如果2月选了29日则后端再判断当年或明年2月具体有多少天
  104. const monthMap = {"1":31, "2":29, "3":31, "4":30, "5":31, "6":30, "7":31, "8":31, "9":30, "10":31, "11":30, "12":31}
  105. const yearArray = Array.from({ length: 12 }, (_, index) => ({
  106. id: index + 1,
  107. value: `${index + 1}`,
  108. label: `${index + 1} 月`,
  109. children: Array.from({ length: monthMap[index + 1] }, (_, dayIndex) => ({
  110. id: dayIndex + 1,
  111. value: `${dayIndex + 1}`,
  112. label: `${dayIndex + 1} 日`
  113. }))
  114. }));
  115. onMounted(()=>{
  116. searchGroup().then(res => {
  117. options.value = res.groupVOList
  118. }).catch(error => {});
  119. })
  120. </script>
  121. <style scoped>
  122. .reportCard{
  123. margin-left: 87px;
  124. background-color: #FAFAFA;
  125. padding-top: 12px;
  126. width: 530px;
  127. .el-sellect{
  128. }
  129. }
  130. </style>