wangyue 2 years ago
parent
commit
d77627f9df
  1. 2
      web/client/src/sections/fillion/actions/infor.js
  2. 8
      web/client/src/sections/fillion/components/enforceTable.js
  3. 2
      web/client/src/sections/fillion/components/infor/details.js
  4. 10
      web/client/src/sections/fillion/components/inforTable.js
  5. 2
      web/client/src/sections/fillion/components/patrolTable.js
  6. 2
      web/client/src/sections/fillion/components/project/project.js
  7. 212
      web/client/src/utils/smart-sort.js

2
web/client/src/sections/fillion/actions/infor.js

@ -41,7 +41,7 @@ export function putOperaTional (query) {
data: query, data: query,
actionType: 'PUT_OPERA_TIONAL', actionType: 'PUT_OPERA_TIONAL',
url: ApiTable.putOperaTional, url: ApiTable.putOperaTional,
msg: { error: '获取车辆信息失败' }, msg: { option: '编辑车辆信息' },
}); });
} }

8
web/client/src/sections/fillion/components/enforceTable.js

@ -1559,10 +1559,10 @@ const openModal = (type, record) => {
rowKey='id' rowKey='id'
onReset={(v) => { onReset={(v) => {
const { id } = depMessage[0] const { id } = depMessage[0]
console.log(id) // console.log(id)
setRegionId(id) // setRegionId(id)
setPlaceType(-1) // setPlaceType(-1)
setDay([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]) // setDay([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')])
setSitename('') setSitename('')
}} }}
rowSelection={{ rowSelection={{

2
web/client/src/sections/fillion/components/infor/details.js

@ -13,7 +13,7 @@ const UserModal = (props) => {
const [recordsay, setRecordsay] = useState()//必填数据 const [recordsay, setRecordsay] = useState()//必填数据
// const [success, setSuccess] = useState() //状态 // const [success, setSuccess] = useState() //状态
// const [establishment, setEstablishment] = useState() //业户类型 // const [establishment, setEstablishment] = useState() //业户类型
console.log(recortd) // console.log(recortd)
useEffect(() => { useEffect(() => {
const array = [] const array = []
if (rewkeys === 'transportation') { if (rewkeys === 'transportation') {

10
web/client/src/sections/fillion/components/inforTable.js

@ -197,11 +197,11 @@ const InForTable = (props) => {
dataIndex: 'createdAt', dataIndex: 'createdAt',
valueType: 'date', valueType: 'date',
render: (dom, record) => { render: (dom, record) => {
return record.testTime.slice(0,10) return record.testTime?.slice(0,10)
}, },
fieldProps: { fieldProps: {
onChange: (value, cs) => { onChange: (value, cs) => {
console.log(cs) // console.log(cs)
setTestTime(cs) setTestTime(cs)
}, },
getPopupContainer: (triggerNode) => triggerNode.parentNode, getPopupContainer: (triggerNode) => triggerNode.parentNode,
@ -423,7 +423,7 @@ const InForTable = (props) => {
setTestTime('') setTestTime('')
}} }}
request={async (params) => { request={async (params) => {
console.log(params) // console.log(params)
const query = { const query = {
limit: params.pageSize, limit: params.pageSize,
page: params.current - 1, page: params.current - 1,
@ -436,7 +436,7 @@ const InForTable = (props) => {
} }
setRowSelected([]); setRowSelected([]);
const res = await dispatch(getPurchase(query)); const res = await dispatch(getPurchase(query));
console.log(res) // console.log(res)
setCounts(res.payload.data.rows) setCounts(res.payload.data.rows)
return { return {
...res, ...res,
@ -448,7 +448,7 @@ const InForTable = (props) => {
optionRender: (searchConfig, formProps, dom) => [ optionRender: (searchConfig, formProps, dom) => [
...dom.reverse(), ...dom.reverse(),
<Popconfirm title="确认导出?" onConfirm={() => { <Popconfirm title="确认导出?" onConfirm={() => {
console.log(rowSelected) // console.log(rowSelected)
props.exports(rowSelected, counts) }}> props.exports(rowSelected, counts) }}>
<Button <Button

2
web/client/src/sections/fillion/components/patrolTable.js

@ -236,7 +236,7 @@ const PatrolNameList = (props) => {
return { return {
onClick: () => { onClick: () => {
if (record) { if (record) {
console.log('record:', record) // console.log('record:', record)
onChange(record); onChange(record);
} }
}, },

2
web/client/src/sections/fillion/components/project/project.js

@ -77,7 +77,7 @@ const ProjectModal = (props) => {
visible={visible} visible={visible}
onVisibleChange={onVisibleChange} onVisibleChange={onVisibleChange}
onFinish={(values) => { onFinish={(values) => {
console.log(values) // console.log(values)
if (rewkeys === 'road') { if (rewkeys === 'road') {
if (typecard == 'compile') { if (typecard == 'compile') {
setDelet(values) setDelet(values)

212
web/client/src/utils/smart-sort.js

@ -0,0 +1,212 @@
'use strict';
export function sort(arr, sortProperty) {
if (!Array.isArray(arr)) {
throw new Error('参数必须是数组');
}
const map = arr.reduce((p, n) => {
let sortProperty_ = sortProperty || 'name'
if (n[sortProperty_]) {
const sortKey = getOrderableString(n[sortProperty_]).join('');
if (p[sortKey]) {
if (Array.isArray(p[sortKey])) {
p[sortKey].push(n);
} else {
p[sortKey] = [p[sortKey], n];
}
} else {
p[sortKey] = n;
}
return p;
} else {
throw new Error('排序对象不包含指定属性或name属性');
}
}, {});
const keys = Object.keys(map);
keys.sort();
let result = [];
keys.forEach(key => {
if (Array.isArray(map[key])) {
result = result.concat(map[key]);
} else {
result.push(map[key]);
}
});
return result;
}
export function getOrderableString(source) {
// let result = source.includes('-') ? source.split('-') : source.includes('_') ? source.split('_') : source.split(''); //区分批量添加测点的-
// result = replaceNumber(result);
let result;
if (source.includes('-') || source.includes('_')) {
result = source.includes('-') ? source.split('-') : source;
result = Array.isArray(result) ? result.reduce((p, n) => {
if (!n.includes('_')) return p.concat(n);
return p.concat(n.split('_'))
}, []) : result.includes('_') ? result.split('_') : result;
result = result.reduce((p, n) => {
p = p.concat(replaceNumber(n.split('')))
return p;
}, []);
} else {
result = replaceNumber(source.split(''))
}
result = replaceChineseNumber(result);
result = replaceSpecialWord(result);
return result;
}
function replaceNumber(source) {
let result = source.concat([]);
let numFound = false;
let numStart = 0;
let baseLine = 0;
for (let i = 0; i < source.length; i++) {
let calc = false;
let len = 0;
let num = parseInt(source[i]);
if (!Number.isNaN(num)) {
if (!numFound) {
numFound = true;
numStart = i;
}
if (i == source.length - 1) {
calc = true;
len = source.length - numStart;
}
}
else {
if (numFound) {
numFound = false;
calc = true;
len = i - numStart;
}
}
if (calc) {
if (len < 5) {
let zeroes = '';
for (let j = 0; j < 5 - len; j++) {
zeroes += "0";
}
if (baseLine > 0 && Number(num) < 10) {
//为解决[3d-12,3d-2]排序结果为[3d-12,3d-2]的问题,添加此处
baseLine--;
}
result.splice(baseLine + numStart, 0, zeroes);
baseLine += zeroes.length;
}
}
}
return result.join('').split('');
}
function replaceSpecialWord(source) {
const map = { "上": "1001", "中": "1002", "下": "1003", "左": "1001", "右": "1003" };
let result = source.join('');
Object.keys(map).forEach(key => {
result = result.replace(key, map[key]);
});
return result.split('');
}
function replaceChineseNumber(source) {
var map =
{
"零": 0,
"一": 1,
"二": 2,
"三": 3,
"四": 4,
"五": 5,
"六": 6,
"七": 7,
"八": 8,
"九": 9,
"十": 10
};
var result = source;
var numFound = false;
var numStart = 0;
var baseLine = 0;
for (let i = 0; i < source.length; i++) {
var calc = false;
var len = 0;
if (map[source[i]]) {//零不作处理
if (!numFound) {
numFound = true;
numStart = i;
}
if (i == source.length - 1) {
calc = true;
len = source.length - numStart;
}
}
else {
if (numFound) {
numFound = false;
calc = true;
len = i - numStart;
}
}
if (calc) {
var cp = '';
var num = -1;
if (len == 1) {
num = map[source[numStart]];
}
else if (len == 2) {
if (source[numStart] == '十') {
num = 10 + map[source[numStart + 1]];
}
else if (source[numStart + 1] == '十') {
num = map[source[numStart]] * 10;
}
else {
num = map[source[numStart]] * 10 + map[source[numStart + 1]];
}
}
else if (len == 3) {
if (source[numStart + 1] == '十') {
num = map[source[numStart]] * 10 + map[source[numStart + 2]];
}
else {
num = map[source[numStart]] * 100 + map[source[numStart + 1]] * 10 + map[source[numStart + 2]];
}
}
if (num != -1) {
var l = 3 - num.toString().length;
var zeroes = '';
for (let j = 0; j < l; j++) {
zeroes += "0";
}
cp = zeroes + num;
result.splice(baseLine + numStart, len, cp);
baseLine += cp.length - len;
}
}
}
return result.join('').split('');
}
Loading…
Cancel
Save