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">
|
<table id="customerTable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>时间</th>
|
|
||||||
<th>客户</th>
|
<th>客户</th>
|
||||||
<th>版本</th>
|
<th>版本</th>
|
||||||
<th>描述</th>
|
<th>描述</th>
|
||||||
@ -116,6 +115,7 @@
|
|||||||
<th>模块</th>
|
<th>模块</th>
|
||||||
<th>状态与进度</th>
|
<th>状态与进度</th>
|
||||||
<th>报告人</th>
|
<th>报告人</th>
|
||||||
|
<th>时间</th>
|
||||||
<th>操作</th>
|
<th>操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@ -438,7 +438,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
|
|
||||||
function exportCustomersToCsv(customers) {
|
function exportCustomersToCsv(customers) {
|
||||||
const header = [
|
const header = [
|
||||||
'时间',
|
|
||||||
'客户',
|
'客户',
|
||||||
'版本',
|
'版本',
|
||||||
'描述',
|
'描述',
|
||||||
@ -446,13 +445,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
'类型',
|
'类型',
|
||||||
'模块',
|
'模块',
|
||||||
'状态与进度',
|
'状态与进度',
|
||||||
'报告人'
|
'报告人',
|
||||||
|
'时间'
|
||||||
].map(toCsvCell).join(',');
|
].map(toCsvCell).join(',');
|
||||||
|
|
||||||
const lines = customers.map(c => {
|
const lines = customers.map(c => {
|
||||||
const date = normalizeDateValue(c.customerName) || (c.customerName || '');
|
const date = normalizeDateValue(c.customerName) || (c.customerName || '');
|
||||||
const cells = [
|
const cells = [
|
||||||
date,
|
|
||||||
c.intendedProduct || '',
|
c.intendedProduct || '',
|
||||||
c.version || '',
|
c.version || '',
|
||||||
c.description || '',
|
c.description || '',
|
||||||
@ -460,7 +459,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
c.type || '',
|
c.type || '',
|
||||||
c.module || '',
|
c.module || '',
|
||||||
c.statusProgress || '',
|
c.statusProgress || '',
|
||||||
c.reporter || ''
|
c.reporter || '',
|
||||||
|
date
|
||||||
];
|
];
|
||||||
return cells.map(toCsvCell).join(',');
|
return cells.map(toCsvCell).join(',');
|
||||||
});
|
});
|
||||||
@ -563,7 +563,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
const date = customer.customerName || '';
|
const date = customer.customerName || '';
|
||||||
|
|
||||||
const fields = [
|
const fields = [
|
||||||
{ value: date, name: 'date' },
|
|
||||||
{ value: customer.intendedProduct || '', name: 'intendedProduct' },
|
{ value: customer.intendedProduct || '', name: 'intendedProduct' },
|
||||||
{ value: customer.version || '', name: 'version' },
|
{ value: customer.version || '', name: 'version' },
|
||||||
{ value: customer.description || '', name: 'description' },
|
{ value: customer.description || '', name: 'description' },
|
||||||
@ -571,7 +570,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
{ value: customer.type || '', name: 'type' },
|
{ value: customer.type || '', name: 'type' },
|
||||||
{ value: customer.module || '', name: 'module' },
|
{ value: customer.module || '', name: 'module' },
|
||||||
{ value: customer.statusProgress || '', name: 'statusProgress' },
|
{ value: customer.statusProgress || '', name: 'statusProgress' },
|
||||||
{ value: customer.reporter || '', name: 'reporter' }
|
{ value: customer.reporter || '', name: 'reporter' },
|
||||||
|
{ value: date, name: 'date' }
|
||||||
];
|
];
|
||||||
|
|
||||||
fields.forEach(field => {
|
fields.forEach(field => {
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crm-go/models"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
"crm-go/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CustomerStorage interface {
|
type CustomerStorage interface {
|
||||||
@ -43,7 +43,21 @@ func (cs *customerStorage) GetAllCustomers() ([]models.Customer, error) {
|
|||||||
cs.mutex.RLock()
|
cs.mutex.RLock()
|
||||||
defer cs.mutex.RUnlock()
|
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) {
|
func (cs *customerStorage) GetCustomerByID(id string) (*models.Customer, error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user