From a6be5cfd9c6fb084af584b77f79100fe32b385c1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 30 十一月 2023 16:20:54 +0800 Subject: [PATCH] 2023-11-30 --- public/media/excel.png | 0 src/tabviews/custom/components/card/cardcellList/index.jsx | 68 +++++++++++++++++++++++++-------- public/media/word.png | 0 src/tabviews/custom/popview/index.jsx | 8 ++++ src/menu/components/card/cardcellcomponent/formconfig.jsx | 3 + src/tabviews/custom/components/table/edit-table/index.jsx | 4 -- src/tabviews/basetable/index.jsx | 9 ++++ public/media/rar.png | 0 src/tabviews/custom/index.jsx | 8 ++++ src/tabviews/custom/components/share/normalTable/index.jsx | 4 -- src/views/billprint/index.jsx | 8 ++++ src/tabviews/custom/components/card/cardcellList/index.scss | 5 ++ public/media/txt.png | 0 public/media/pdf.png | 0 14 files changed, 92 insertions(+), 25 deletions(-) diff --git a/public/media/excel.png b/public/media/excel.png new file mode 100644 index 0000000..005a7e6 --- /dev/null +++ b/public/media/excel.png Binary files differ diff --git a/public/media/pdf.png b/public/media/pdf.png new file mode 100644 index 0000000..2d1b8ee --- /dev/null +++ b/public/media/pdf.png Binary files differ diff --git a/public/media/rar.png b/public/media/rar.png new file mode 100644 index 0000000..50d1f8c --- /dev/null +++ b/public/media/rar.png Binary files differ diff --git a/public/media/txt.png b/public/media/txt.png new file mode 100644 index 0000000..132e155 --- /dev/null +++ b/public/media/txt.png Binary files differ diff --git a/public/media/word.png b/public/media/word.png new file mode 100644 index 0000000..87055ec --- /dev/null +++ b/public/media/word.png Binary files differ diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index d682050..2f83093 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -60,6 +60,7 @@ let linkTypes = [ { value: 'tel', text: '鐢佃瘽' }, { value: 'email', text: '閭' }, + { value: 'download', text: '涓嬭浇' }, { value: 'other', text: '鍏朵粬' } ] @@ -69,6 +70,7 @@ { value: 'email', text: '閭' }, { value: 'qywx', text: '浼佷笟寰俊' }, { value: 'linkmenu', text: '鍏宠仈鑿滃崟' }, + { value: 'download', text: '涓嬭浇' }, { value: 'other', text: '鍏朵粬' } ] } else if (appType === 'pc') { @@ -76,6 +78,7 @@ { value: 'tel', text: '鐢佃瘽' }, { value: 'email', text: '閭' }, { value: 'linkmenu', text: '鍏宠仈鑿滃崟' }, + { value: 'download', text: '涓嬭浇' }, { value: 'other', text: '鍏朵粬' } ] } diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index d5c7dc8..f2dd7d0 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -409,6 +409,11 @@ } } } + + if (cell.marks && cell.marks.length === 0) { + cell.marks = null + } + return true }) @@ -424,6 +429,10 @@ col.linkThdMenu = '' } + if (col.marks && col.marks.length === 0) { + col.marks = null + } + return true }) } diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 4a1e085..c1e0fc5 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -197,26 +197,36 @@ // }) // return // } - - let Id = '' - - if (cards.subtype === 'propcard' && cardCell) { - Id = cardCell.setting.primaryId || '' - } else { - Id = data[cards.setting.primaryKey] || '' - } - if (card.joint === 'true') { - let con = '?' - - if (/\?/ig.test(url)) { - con = '&' + if (/^http.+(.txt|.doc|.docx|.pdf|.xlsx|.xls|.zip|.rar|.ppt)$/i.test(url)) { + let d = document.createElement('a') + d.href = url + d.setAttribute('download', 'download') + d.setAttribute('target', '_blank') + document.body.appendChild(d) + d.click() + d.remove() + } else { + if (card.joint === 'true') { + let Id = '' + + if (cards.subtype === 'propcard' && cardCell) { + Id = cardCell.setting.primaryId || '' + } else { + Id = data[cards.setting.primaryKey] || '' + } + + let con = '?' + + if (/\?/ig.test(url)) { + con = '&' + } + + url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` } - - url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + + window.open(url) } - - window.open(url) } getColor = (marks) => { @@ -435,6 +445,30 @@ } className = mark.signType } + + if (card.linkType === 'download') { + let url = '' + + if (card.link === 'static') { + url = card.linkurl + } else { + url = data[card.linkurl] + } + + if (/^http.+(.txt|.doc|.docx|.pdf|.xlsx|.xls|.zip|.rar)$/i.test(url)) { + if (/pdf$/i.test(url)) { + val = <><img src="/media/pdf.png" className="file-image" alt=""/> {val}</> + } else if (/(.doc|.docx)$/i.test(url)) { + val = <><img src="/media/word.png" className="file-image" alt=""/> {val}</> + } else if (/(.xlsx|.xls)$/i.test(url)) { + val = <><img src="/media/excel.png" className="file-image" alt=""/> {val}</> + } else if (/(.zip|.rar)$/i.test(url)) { + val = <><img src="/media/rar.png" className="file-image" alt=""/> {val}</> + } else { + val = <><img src="/media/txt.png" className="file-image" alt=""/> {val}</> + } + } + } if (card.link || (card.anchors && card.anchors.length > 0)) { _style.cursor = 'pointer' diff --git a/src/tabviews/custom/components/card/cardcellList/index.scss b/src/tabviews/custom/components/card/cardcellList/index.scss index 07ac844..fbd7791 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.scss +++ b/src/tabviews/custom/components/card/cardcellList/index.scss @@ -6,6 +6,11 @@ .ant-btn { padding: 0; } + .file-image { + max-height: 100%; + vertical-align: top; + margin-right: 2px; + } .ant-typography { margin: 0; padding: 0; diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 905d316..01eacd8 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -499,10 +499,6 @@ } else if (_format && !Math.floor(Math.random() * radio)) { item.blur = true } - - if (item.marks && item.marks.length === 0) { - item.marks = '' - } if (item.field) { orderfields[item.uuid] = item.field diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index 6cc0650..d2f11ed 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -113,10 +113,6 @@ item.type = 'text' } - if (item.marks && item.marks.length === 0) { - item.marks = '' - } - if (item.editable === 'true') { setting.hasSubmit = setting.commit !== 'change' item.$ctrl = setting.commit === 'change' diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index eee9fa8..5af3787 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -661,6 +661,10 @@ col.linkThdMenu = '' } + if (col.marks && col.marks.length === 0) { + col.marks = null + } + return true }) } @@ -960,6 +964,10 @@ cell.style.verticalAlign = 'top' } + if (cell.marks && cell.marks.length === 0) { + cell.marks = null + } + if (['text', 'number', 'formula'].includes(cell.eleType)) { if (!cell.height) { cell.innerHeight = 'auto' diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 5e0431c..eb22032 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -405,6 +405,10 @@ col.linkThdMenu = '' } + if (col.marks && col.marks.length === 0) { + col.marks = null + } + return true }) } @@ -677,6 +681,10 @@ cell.style.verticalAlign = 'top' } + if (cell.marks && cell.marks.length === 0) { + cell.marks = null + } + if (['text', 'number', 'formula'].includes(cell.eleType)) { if (!cell.height) { cell.innerHeight = 'auto' diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index d7d4ea9..0c287de 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -395,6 +395,10 @@ } else { item.IsSort = 'false' } + + if (item.marks && item.marks.length === 0) { + item.marks = null + } return true }) @@ -614,6 +618,10 @@ if (cell.style.display === 'inline-block') { cell.style.verticalAlign = 'top' } + + if (cell.marks && cell.marks.length === 0) { + cell.marks = null + } if (['text', 'number', 'formula'].includes(cell.eleType)) { cell.innerHeight = cell.innerHeight || 'auto' -- Gitblit v1.8.0