feat: Add new server binaries and reorder 'Time' column in customer table and CSV export.
This commit is contained in:
parent
9e8c8ec8f2
commit
2b50b3a2f7
@ -107,7 +107,6 @@
|
||||
<table id="customerTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>时间</th>
|
||||
<th>客户</th>
|
||||
<th>版本</th>
|
||||
<th>描述</th>
|
||||
@ -116,6 +115,7 @@
|
||||
<th>模块</th>
|
||||
<th>状态与进度</th>
|
||||
<th>报告人</th>
|
||||
<th>时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@ -438,7 +438,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
function exportCustomersToCsv(customers) {
|
||||
const header = [
|
||||
'时间',
|
||||
'客户',
|
||||
'版本',
|
||||
'描述',
|
||||
@ -446,13 +445,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
'类型',
|
||||
'模块',
|
||||
'状态与进度',
|
||||
'报告人'
|
||||
'报告人',
|
||||
'时间'
|
||||
].map(toCsvCell).join(',');
|
||||
|
||||
const lines = customers.map(c => {
|
||||
const date = normalizeDateValue(c.customerName) || (c.customerName || '');
|
||||
const cells = [
|
||||
date,
|
||||
c.intendedProduct || '',
|
||||
c.version || '',
|
||||
c.description || '',
|
||||
@ -460,7 +459,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
c.type || '',
|
||||
c.module || '',
|
||||
c.statusProgress || '',
|
||||
c.reporter || ''
|
||||
c.reporter || '',
|
||||
date
|
||||
];
|
||||
return cells.map(toCsvCell).join(',');
|
||||
});
|
||||
@ -563,7 +563,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const date = customer.customerName || '';
|
||||
|
||||
const fields = [
|
||||
{ value: date, name: 'date' },
|
||||
{ value: customer.intendedProduct || '', name: 'intendedProduct' },
|
||||
{ value: customer.version || '', name: 'version' },
|
||||
{ value: customer.description || '', name: 'description' },
|
||||
@ -571,7 +570,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
{ value: customer.type || '', name: 'type' },
|
||||
{ value: customer.module || '', name: 'module' },
|
||||
{ value: customer.statusProgress || '', name: 'statusProgress' },
|
||||
{ value: customer.reporter || '', name: 'reporter' }
|
||||
{ value: customer.reporter || '', name: 'reporter' },
|
||||
{ value: date, name: 'date' }
|
||||
];
|
||||
|
||||
fields.forEach(field => {
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"crm-go/models"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"sync"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"time"
|
||||
"crm-go/models"
|
||||
)
|
||||
|
||||
type CustomerStorage interface {
|
||||
@ -43,7 +43,21 @@ func (cs *customerStorage) GetAllCustomers() ([]models.Customer, error) {
|
||||
cs.mutex.RLock()
|
||||
defer cs.mutex.RUnlock()
|
||||
|
||||
return cs.LoadCustomers()
|
||||
customers, err := cs.LoadCustomers()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Sort by CreatedAt in descending order (newest first)
|
||||
for i := 0; i < len(customers)-1; i++ {
|
||||
for j := i + 1; j < len(customers); j++ {
|
||||
if customers[i].CreatedAt.Before(customers[j].CreatedAt) {
|
||||
customers[i], customers[j] = customers[j], customers[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return customers, nil
|
||||
}
|
||||
|
||||
func (cs *customerStorage) GetCustomerByID(id string) (*models.Customer, error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user