From b3852c89968e9d5d6a3b9a4998d869bfbbfd1842 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 01 十二月 2020 18:19:04 +0800 Subject: [PATCH] 2020-12-01 --- src/utils/utils.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index a2b1ad5..19713b8 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -524,7 +524,7 @@ } /** - * @description 鎷兼帴鎼滅储鏉′欢main + * @description 鑾峰彇鎼滅储鐢ㄤ簬姝e垯鏇挎崲 * @param {Array} searches 鎼滅储鏉′欢 * @return {String} searchText 鎷兼帴缁撴灉 */ @@ -538,9 +538,7 @@ key: search.key, match: search.match, type: search.type, - label: search.label, - value: search.value, - required: search.required + value: search.value } if (fieldmap.has(item.key)) { @@ -613,6 +611,50 @@ } /** + * @description 鑾峰彇鎼滅储鐢ㄤ簬姝e垯鏇挎崲 + * @param {Array} searches 鎼滅储鏉′欢 + * @return {String} searchText 鎷兼帴缁撴灉 + */ + static getRegOptions (searches) { + if (!searches || searches.length === 0) return [] + + let options = [] + let fieldmap = new Map() + searches.forEach(search => { + let item = { + key: search.field, + value: '0' + } + + if (fieldmap.has(item.key)) { + item.key = item.key + '1' + } + + fieldmap.set(item.key, true) + + if (search.type === 'group') { + options.push({ + key: search.datefield, + value: '0' + }) + if (search.transfer === 'true') { + options.push(item) + } + } else if (['datemonth', 'dateweek', 'daterange'].includes(search.type)) { + options.push(item) + options.push({ + key: item.key + '1', + value: '0' + }) + } else { + options.push(item) + } + }) + + return options + } + + /** * @description 鎷兼帴鎼滅储鏉′欢datamanage * @param {Array} searches 鎼滅储鏉′欢 * @return {String} searchText 鎷兼帴缁撴灉 -- Gitblit v1.8.0