From b67e6d3d48ef2d25d67ad49990322e34f7798aa7 Mon Sep 17 00:00:00 2001 From: xingyongchun Date: Fri, 29 Jul 2022 09:59:00 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=9B=91=E6=B5=8B=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/fillion/components/inforTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/src/sections/fillion/components/inforTable.js b/web/client/src/sections/fillion/components/inforTable.js index aa351cfb..7aa17c1e 100644 --- a/web/client/src/sections/fillion/components/inforTable.js +++ b/web/client/src/sections/fillion/components/inforTable.js @@ -197,7 +197,7 @@ const InForTable = (props) => { dataIndex: 'createdAt', valueType: 'date', render: (dom, record) => { - return record.testTime.slice(0,10) + return record.testTime?.slice(0,10) }, fieldProps: { onChange: (value, cs) => { From aa3744bd431d03b18031e77e929ae05393eb0df3 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 29 Jul 2022 10:27:01 +0800 Subject: [PATCH 2/3] sort file --- web/client/src/utils/smart-sort.js | 212 +++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 web/client/src/utils/smart-sort.js diff --git a/web/client/src/utils/smart-sort.js b/web/client/src/utils/smart-sort.js new file mode 100644 index 00000000..9a667e68 --- /dev/null +++ b/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(''); +} \ No newline at end of file From 61f63ce166b7c19c6907222c1b6062e43457bba7 Mon Sep 17 00:00:00 2001 From: xingyongchun Date: Fri, 29 Jul 2022 10:27:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=BF=90=E6=94=BF=E5=AE=A2=E8=BF=90?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=BD=A6=E8=BE=86=E4=BF=A1=E6=81=AF=E6=B2=A1?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/fillion/actions/infor.js | 2 +- .../src/sections/fillion/components/enforceTable.js | 8 ++++---- .../src/sections/fillion/components/infor/details.js | 2 +- web/client/src/sections/fillion/components/inforTable.js | 8 ++++---- web/client/src/sections/fillion/components/patrolTable.js | 2 +- .../src/sections/fillion/components/project/project.js | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/web/client/src/sections/fillion/actions/infor.js b/web/client/src/sections/fillion/actions/infor.js index dd4d0e29..83837a88 100644 --- a/web/client/src/sections/fillion/actions/infor.js +++ b/web/client/src/sections/fillion/actions/infor.js @@ -41,7 +41,7 @@ export function putOperaTional (query) { data: query, actionType: 'PUT_OPERA_TIONAL', url: ApiTable.putOperaTional, - msg: { error: '获取车辆信息失败' }, + msg: { option: '编辑车辆信息' }, }); } diff --git a/web/client/src/sections/fillion/components/enforceTable.js b/web/client/src/sections/fillion/components/enforceTable.js index cbeca915..c5eef424 100644 --- a/web/client/src/sections/fillion/components/enforceTable.js +++ b/web/client/src/sections/fillion/components/enforceTable.js @@ -1559,10 +1559,10 @@ const openModal = (type, record) => { rowKey='id' onReset={(v) => { const { id } = depMessage[0] - console.log(id) - setRegionId(id) - setPlaceType(-1) - setDay([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]) + // console.log(id) + // setRegionId(id) + // setPlaceType(-1) + // setDay([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]) setSitename('') }} rowSelection={{ diff --git a/web/client/src/sections/fillion/components/infor/details.js b/web/client/src/sections/fillion/components/infor/details.js index 4df3a38c..94f67b68 100644 --- a/web/client/src/sections/fillion/components/infor/details.js +++ b/web/client/src/sections/fillion/components/infor/details.js @@ -13,7 +13,7 @@ const UserModal = (props) => { const [recordsay, setRecordsay] = useState()//必填数据 // const [success, setSuccess] = useState() //状态 // const [establishment, setEstablishment] = useState() //业户类型 - console.log(recortd) + // console.log(recortd) useEffect(() => { const array = [] if (rewkeys === 'transportation') { diff --git a/web/client/src/sections/fillion/components/inforTable.js b/web/client/src/sections/fillion/components/inforTable.js index 7aa17c1e..c090c0da 100644 --- a/web/client/src/sections/fillion/components/inforTable.js +++ b/web/client/src/sections/fillion/components/inforTable.js @@ -201,7 +201,7 @@ const InForTable = (props) => { }, fieldProps: { onChange: (value, cs) => { - console.log(cs) + // console.log(cs) setTestTime(cs) }, getPopupContainer: (triggerNode) => triggerNode.parentNode, @@ -423,7 +423,7 @@ const InForTable = (props) => { setTestTime('') }} request={async (params) => { - console.log(params) + // console.log(params) const query = { limit: params.pageSize, page: params.current - 1, @@ -436,7 +436,7 @@ const InForTable = (props) => { } setRowSelected([]); const res = await dispatch(getPurchase(query)); - console.log(res) + // console.log(res) setCounts(res.payload.data.rows) return { ...res, @@ -448,7 +448,7 @@ const InForTable = (props) => { optionRender: (searchConfig, formProps, dom) => [ ...dom.reverse(), { - console.log(rowSelected) + // console.log(rowSelected) props.exports(rowSelected, counts) }}>