YearReport.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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: 146.5px; height: 32px"
  15. :disabled="disableType.contentDisable"
  16. />
  17. </el-col>
  18. </el-form-item>
  19. <el-col class="text-center" :span="2" style="padding-bottom: 10px">
  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: 146.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 v-model="prop.form.recipientType" :disabled="disableType.contentDisable">
  39. <el-radio :value="1">全员</el-radio>
  40. <el-radio :value="2">分组</el-radio>
  41. <el-radio :value="3">自定义</el-radio>
  42. </el-radio-group>
  43. </el-form-item>
  44. <el-form-item
  45. v-if="prop.form.recipientType === 2"
  46. label="选择分组:"
  47. required
  48. style="margin-top: 10px"
  49. prop="userGroupList"
  50. >
  51. <el-col :span="10">
  52. <el-select
  53. v-model="prop.form.userGroupList"
  54. multiple
  55. placeholder="请选择分组"
  56. style="width: 326px"
  57. :disabled="disableType.contentDisable"
  58. >
  59. <el-option
  60. v-for="item in options"
  61. :key="item.userGroupId"
  62. :label="item.name"
  63. :value="item.userGroupId"
  64. />
  65. </el-select>
  66. </el-col>
  67. </el-form-item>
  68. <el-form-item
  69. v-if="form.recipientType === 3"
  70. label="选择人员:"
  71. required
  72. prop="customUserList.value"
  73. style="width: 526px; margin-top: 10px"
  74. :rules="{ required: true, message: '请选择推送人员', trigger: 'blur' }"
  75. >
  76. <el-col :span="18">
  77. <DefaultPersonSelection :form="form" :disableType="disableType" />
  78. </el-col>
  79. </el-form-item>
  80. </div>
  81. </template>
  82. <script lang="ts" setup>
  83. import { ref, onMounted } from 'vue';
  84. import { searchGroup } from '@/api/message/report-message';
  85. import DefaultPersonSelection from './components/DefaultPersonSelection.vue';
  86. const prop = defineProps(['form', 'disableType']);
  87. const options = ref();
  88. const handleChange = () => {
  89. if (prop.form.monthList.length === 0) {
  90. prop.form.monthList.push(prop.form.monthAndDayList[0]);
  91. prop.form.dayOfMonthList.push(prop.form.monthAndDayList[1]);
  92. } else {
  93. if (prop.form.statisticType != 3) {
  94. // 非季报
  95. prop.form.monthList.length = 0;
  96. prop.form.monthList.push(prop.form.monthAndDayList[0]);
  97. prop.form.dayOfMonthList.length = 0;
  98. prop.form.dayOfMonthList.push(prop.form.monthAndDayList[1]);
  99. }
  100. }
  101. };
  102. // 默认每年2月都是29天,如果2月选了29日则后端再判断当年或明年2月具体有多少天
  103. const monthMap = {
  104. '1': 31,
  105. '2': 29,
  106. '3': 31,
  107. '4': 30,
  108. '5': 31,
  109. '6': 30,
  110. '7': 31,
  111. '8': 31,
  112. '9': 30,
  113. '10': 31,
  114. '11': 30,
  115. '12': 31,
  116. };
  117. const yearArray = Array.from({ length: 12 }, (_, index) => ({
  118. id: index + 1,
  119. value: `${index + 1}`,
  120. label: `${index + 1} 月`,
  121. children: Array.from({ length: monthMap[index + 1] }, (_, dayIndex) => ({
  122. id: dayIndex + 1,
  123. value: `${dayIndex + 1}`,
  124. label: `${dayIndex + 1} 日`,
  125. })),
  126. }));
  127. onMounted(() => {
  128. searchGroup()
  129. .then((res) => {
  130. options.value = res.groupVOList;
  131. })
  132. .catch((e) => {
  133. console.log(e);
  134. });
  135. });
  136. </script>
  137. <style scoped>
  138. .reportCard {
  139. margin-left: 87px;
  140. padding: 12px 0px 0px 12px;
  141. margin-bottom: 16px;
  142. background-color: #fafafa;
  143. width: 530px;
  144. box-sizing: border-box;
  145. }
  146. .el-form-item--default {
  147. /* margin-bottom: 8px; */
  148. margin-bottom: 0px;
  149. padding-bottom: 10px;
  150. }
  151. .reportCard > .el-form-item:last-child {
  152. /* background:#ff0000; */
  153. padding-bottom: 16px;
  154. }
  155. ::v-deep .el-select__selection {
  156. min-height: 25px;
  157. }
  158. </style>