feat:新增意向产品,去掉试用时间
This commit is contained in:
parent
df1be594ca
commit
db7646dbb1
@ -1559,6 +1559,7 @@ td.overflow-cell {
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
@ -2323,11 +2324,9 @@ tr:hover .action-cell {
|
||||
}
|
||||
|
||||
.customer-tab.active {
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
background: linear-gradient(135deg,
|
||||
var(--primary-orange),
|
||||
var(--secondary-orange)
|
||||
);
|
||||
var(--secondary-orange));
|
||||
color: var(--white);
|
||||
border-color: transparent;
|
||||
box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1410,7 +1410,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
const ctx = document.getElementById("statusChart").getContext("2d");
|
||||
const selectedField = document.getElementById("chartFieldSelect").value;
|
||||
const statusChartTitleEl = document.getElementById("statusChartTitle");
|
||||
const chartTitle = statusChartTitleEl ? statusChartTitleEl.value : "数据分布";
|
||||
const chartTitle = statusChartTitleEl ? statusChartTitleEl.value : "模块分布";
|
||||
|
||||
const fieldCount = {};
|
||||
customers.forEach((customer) => {
|
||||
@ -1518,7 +1518,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
const ctx = canvas.getContext("2d");
|
||||
const typeChartTitleEl = document.getElementById("typeChartTitle");
|
||||
const chartTitle = typeChartTitleEl ? typeChartTitleEl.value : "客户类型";
|
||||
const chartTitle = typeChartTitleEl ? typeChartTitleEl.value : "类型分布";
|
||||
|
||||
if (typeChartInstance) {
|
||||
typeChartInstance.destroy();
|
||||
|
||||
@ -109,6 +109,9 @@ function initTrialPeriodsPage() {
|
||||
});
|
||||
}
|
||||
|
||||
// Setup trial time visibility based on intended product selection
|
||||
setupTrialTimeVisibility();
|
||||
|
||||
// Load customers map for displaying customer names
|
||||
loadCustomersMap();
|
||||
}
|
||||
@ -184,6 +187,38 @@ function setupIntendedProductCheckboxes(otherCheckboxId, otherInputId) {
|
||||
});
|
||||
}
|
||||
|
||||
// Setup trial time visibility based on intended product selection
|
||||
// When only "robogo" or "其他" is selected (no "数据闭环"), hide start/end time fields
|
||||
function setupTrialTimeVisibility() {
|
||||
const checkboxGroup = document.getElementById('trialIntendedProductGroup');
|
||||
if (!checkboxGroup) return;
|
||||
|
||||
const checkboxes = checkboxGroup.querySelectorAll('input[type="checkbox"]');
|
||||
const startTimeGroup = document.getElementById('trialStartTimeGroup');
|
||||
const endTimeGroup = document.getElementById('trialEndTimeGroup');
|
||||
|
||||
if (!startTimeGroup || !endTimeGroup) return;
|
||||
|
||||
function updateTimeVisibility() {
|
||||
const checkedBoxes = checkboxGroup.querySelectorAll('input[type="checkbox"]:checked');
|
||||
const checkedValues = Array.from(checkedBoxes).map(cb => cb.value);
|
||||
|
||||
// Show time fields only if "数据闭环" is selected
|
||||
const showTimeFields = checkedValues.includes('数据闭环');
|
||||
|
||||
startTimeGroup.style.display = showTimeFields ? 'block' : 'none';
|
||||
endTimeGroup.style.display = showTimeFields ? 'block' : 'none';
|
||||
}
|
||||
|
||||
// Add change listener to all checkboxes
|
||||
checkboxes.forEach(checkbox => {
|
||||
checkbox.addEventListener('change', updateTimeVisibility);
|
||||
});
|
||||
|
||||
// Initial visibility check
|
||||
updateTimeVisibility();
|
||||
}
|
||||
|
||||
// Get intended product values from checkboxes (returns comma-separated string)
|
||||
function getIntendedProductValues(checkboxName, otherInputId) {
|
||||
const checkboxes = document.querySelectorAll(`input[name="${checkboxName}"]:checked`);
|
||||
@ -642,7 +677,9 @@ async function createTrialPeriodFromPage() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!startTime || !endTime) {
|
||||
// Only require start/end time if "数据闭环" is selected
|
||||
const requiresTimeFields = intendedProduct.includes('数据闭环');
|
||||
if (requiresTimeFields && (!startTime || !endTime)) {
|
||||
alert('请填写开始时间和结束时间');
|
||||
return;
|
||||
}
|
||||
@ -652,8 +689,8 @@ async function createTrialPeriodFromPage() {
|
||||
customerName: customerName,
|
||||
source: source,
|
||||
intendedProduct: intendedProduct,
|
||||
startTime: new Date(startTime).toISOString(),
|
||||
endTime: new Date(endTime).toISOString(),
|
||||
startTime: startTime ? new Date(startTime).toISOString() : '',
|
||||
endTime: endTime ? new Date(endTime).toISOString() : '',
|
||||
isTrial: isTrial
|
||||
};
|
||||
|
||||
|
||||
@ -69,18 +69,25 @@ func (h *TrialPeriodHandler) CreateTrialPeriod(w http.ResponseWriter, r *http.Re
|
||||
return
|
||||
}
|
||||
|
||||
// Parse start and end times
|
||||
startTime, err := time.Parse(time.RFC3339, req.StartTime)
|
||||
if err != nil {
|
||||
// Parse start and end times (optional - only required for 数据闭环)
|
||||
var startTime, endTime time.Time
|
||||
var parseErr error
|
||||
|
||||
if req.StartTime != "" {
|
||||
startTime, parseErr = time.Parse(time.RFC3339, req.StartTime)
|
||||
if parseErr != nil {
|
||||
http.Error(w, "Invalid start time format", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
endTime, err := time.Parse(time.RFC3339, req.EndTime)
|
||||
if err != nil {
|
||||
if req.EndTime != "" {
|
||||
endTime, parseErr = time.Parse(time.RFC3339, req.EndTime)
|
||||
if parseErr != nil {
|
||||
http.Error(w, "Invalid end time format", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
trialPeriod := models.TrialPeriod{
|
||||
CustomerName: req.CustomerName,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user