diff --git a/src/views/services/directivePackage/components/ConfigServiceDirectiveList.vue b/src/views/services/directivePackage/components/ConfigServiceDirectiveList.vue index ec86012..f998419 100644 --- a/src/views/services/directivePackage/components/ConfigServiceDirectiveList.vue +++ b/src/views/services/directivePackage/components/ConfigServiceDirectiveList.vue @@ -10,8 +10,7 @@ + placeholder="请选择分类标签" allowClear :ignoreDisabled="true" @change="onInstructionTagChange" /> @@ -20,8 +19,7 @@ + placeholder="请选择服务类别" allowClear :ignoreDisabled="true" @change="onCategoryChange" /> @@ -44,7 +42,8 @@ 查询 - 重置 + 重置 @@ -104,6 +103,66 @@ + + + + + @@ -128,6 +187,10 @@ const queryParam = reactive({}); const registerModal = ref(); const directiveInfo = ref({}); const checkListData = ref([]); +const isModalVisible = ref(false); // 控制弹窗的显示与否 +const cycleType = ref('week'); // 周期类型:week 或 month +const selectedDays = ref([]); // 存储选择的周几 +const selectedDaysInMonth = ref(null); // 选择的日期(每月) // 接收已选择的指令列表 const props = defineProps({ @@ -170,6 +233,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ beforeFetch: async (params) => { params.column = 'createTime'; params.order = 'desc'; + params.cycleType = '1,2' let rangerQuery = await setRangeQuery(); return Object.assign(params, rangerQuery); }, @@ -188,10 +252,53 @@ function handleSuccess() { /** * 选择指令 */ +// function handleCheck(record) { +// console.log("🚀 ~ handleSelect ~ record:", record) +// checkListData.value.push(record); +// emit('checkDirective', checkListData.value); +// } function handleCheck(record) { - console.log("🚀 ~ handleSelect ~ record:", record) - checkListData.value.push(record); - emit('checkDirective', checkListData.value); + if (record.cycleType == 2) { + isModalVisible.value = true; + // 将选中的指令记录传入弹窗内 + directiveInfo.value = record; + } else { + checkListData.value.push(record); + emit('checkDirective', checkListData.value); + } +} + +// 点击确认 +function onConfirm() { + if (cycleType.value === 'week' && selectedDays.value.length === 0) { + alert('请至少选择一个星期几'); + return; + } + if (cycleType.value === 'month' && (!selectedDaysInMonth.value || selectedDaysInMonth.value.length === 0)) { + alert('请至少选择一个日期'); + return; + } + + // 处理选择的周期 + let content_ = [{ + ...directiveInfo.value + }] + if (cycleType.value === 'week') { + content_[0].cycleTypeShow = '每周' + content_[0].cycleTypeValue = selectedDays.value[0] + } + if (cycleType.value === 'month') { + content_[0].cycleTypeShow = '每月' + content_[0].cycleTypeValue = selectedDaysInMonth.value + } + checkListData.value.push(content_[0]); + isModalVisible.value = false; // 关闭弹窗 + emit('checkDirective', checkListData.value); // 更新父组件数据 +} + +// 点击取消 +function onCancel() { + isModalVisible.value = false; // 关闭弹窗 } /** @@ -329,4 +436,27 @@ audio::-webkit-media-controls-time-remaining-display { :deep(.ant-table-title) { display: none !important; } + +.modal-content { + padding: 16px; +} + +.week-selection, +.month-selection { + margin-top: 16px; +} + +a-radio-group { + margin-bottom: 16px; +} + +a-checkbox-group { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +a-checkbox { + margin-bottom: 8px; +} \ No newline at end of file