diff --git a/package.json b/package.json index b781b64..c9343e0 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "@dnd-kit/core": "^6.1.0", "@element-plus/icons-vue": "^2.3.1", "@onlyoffice/document-editor-vue": "^1.5.0", + "@sv-print/vue3": "^0.2.2", "@tinymce/tinymce-vue": "^5.1.1", "@vitejs/plugin-vue": "^4.2.3", "@vueup/vue-quill": "^1.2.0", @@ -61,17 +62,20 @@ "element-resize-detector": "^1.2.4", "font-awesome": "^4.7.0", "html2canvas": "^1.4.1", - "jquery": "^3.7.1", + "install": "^0.13.0", "js-beautify": "^1.14.8", "js-md5": "^0.7.3", + "jsbarcode": "^3.12.1", "jszip": "^3.10.1", "mapv-three": "^1.0.18", "md5": "^2.3.0", + "npm": "^11.4.2", "nprogress": "^0.2.0", "path-browserify": "^1.0.1", "path-to-regexp": "^6.2.0", "pinia": "^2.1.6", "province-city-china": "^8.5.8", + "qrcode": "^1.5.4", "quill-image-resize-custom-module": "^4.1.7", "quill-image-uploader": "^1.3.0", "react-dnd-html5-backend": "^16.0.1", @@ -88,7 +92,7 @@ "vue-baidu-map-3x": "^1.0.35", "vue-demi": "^0.14.10", "vue-i18n": "9.2.2", - "vue-plugin-hiprint": "^0.0.59-beta4", + "vue-plugin-hiprint": "^0.0.60", "vue-router": "^4.2.0", "vue3-dnd": "^2.1.0", "vue3-ruler-tool": "^0.0.1", diff --git a/public/print-lock.css b/public/print-lock.css new file mode 100644 index 0000000..82c1404 --- /dev/null +++ b/public/print-lock.css @@ -0,0 +1,352 @@ +@media print { + body { + margin: 0px; + padding: 0px; + } +} + +@page { + margin: 0; +} + +.hiprint-printPaper * { + box-sizing: border-box; + -moz-box-sizing: border-box; /* Firefox */ + -webkit-box-sizing: border-box; /* Safari */ +} + +.hiprint-printPaper *:focus { + outline: -webkit-focus-ring-color auto 0px; +} + +.hiprint-printPaper { + position: relative; + padding: 0 0 0 0; + page-break-after: always; + -webkit-user-select: none; /* Chrome/Safari/Opera */ + -moz-user-select: none; /* Firefox */ + user-select: none; + overflow-x: hidden; + overflow: hidden; +} + +.hiprint-printPaper .hiprint-printPaper-content { + position: relative; +} + +/* 火狐浏览器打印 第一页过后 重叠问题 */ +@-moz-document url-prefix() { + .hiprint-printPaper .hiprint-printPaper-content { + position: relative; + margin-top: 20px; + top: -20px + } +} + +.hiprint-printPaper.design { + overflow: visible; +} + + +.hiprint-printTemplate .hiprint-printPanel { + page-break-after: always; +} + +.hiprint-printPaper, hiprint-printPanel { + box-sizing: border-box; + border: 0px; +} + +.hiprint-printPanel .hiprint-printPaper:last-child { + page-break-after: avoid; +} + +.hiprint-printTemplate .hiprint-printPanel:last-child { + page-break-after: avoid; +} + +.hiprint-printPaper .hideheaderLinetarget { + border-top: 0px dashed rgb(201, 190, 190) !important; +} + +.hiprint-printPaper .hidefooterLinetarget { + border-top: 0px dashed rgb(201, 190, 190) !important; +} + +.hiprint-printPaper.design { + border: 1px dashed rgba(170, 170, 170, 0.7); +} + +.design .hiprint-printElement-table-content, .design .hiprint-printElement-longText-content { + overflow: hidden; + box-sizing: border-box; +} + +.design .resize-panel { + box-sizing: border-box; + border: 1px dotted; +} + +.hiprint-printElement-text { + background-color: transparent; + background-repeat: repeat; + padding: 0 0 0 0; + border: 0.75pt none rgb(0, 0, 0); + direction: ltr; + font-family: 'SimSun'; + font-size: 9pt; + font-style: normal; + font-weight: normal; + padding-bottom: 0pt; + padding-left: 0pt; + padding-right: 0pt; + padding-top: 0pt; + text-align: left; + text-decoration: none; + line-height: 9.75pt; + box-sizing: border-box; + word-wrap: break-word; + word-break: break-all; +} + +.design .hiprint-printElement-text-content { + border: 1px dashed rgb(206, 188, 188); + box-sizing: border-box; +} + +.hiprint-printElement-longText { + background-color: transparent; + background-repeat: repeat; + border: 0.75pt none rgb(0, 0, 0); + direction: ltr; + font-family: 'SimSun'; + font-size: 9pt; + font-style: normal; + font-weight: normal; + padding-bottom: 0pt; + padding-left: 0pt; + padding-right: 0pt; + padding-top: 0pt; + text-align: left; + text-decoration: none; + line-height: 9.75pt; + box-sizing: border-box; + word-wrap: break-word; + word-break: break-all; + /*white-space: pre-wrap*/ +} + + +.hiprint-printElement-table { + background-color: transparent; + background-repeat: repeat; + color: rgb(0, 0, 0); + border-color: rgb(0, 0, 0); + border-style: none; + direction: ltr; + font-family: 'SimSun'; + font-size: 9pt; + font-style: normal; + font-weight: normal; + padding-bottom: 0pt; + padding-left: 0pt; + padding-right: 0pt; + padding-top: 0pt; + text-align: left; + text-decoration: none; + padding: 0 0 0 0; + box-sizing: border-box; + line-height: 9.75pt; +} + +.hiprint-printElement-table thead { + background: #e8e8e8; + font-weight: 700; +} + +table.hiprint-printElement-tableTarget { + width: 100%; +} + +.hiprint-printElement-tableTarget, .hiprint-printElement-tableTarget tr, .hiprint-printElement-tableTarget td { + border-color: rgb(0, 0, 0); + /*border-style: none;*/ + /*border: 1px solid rgb(0, 0, 0);*/ + font-weight: normal; + direction: ltr; + padding-bottom: 0pt; + padding-left: 4pt; + padding-right: 4pt; + padding-top: 0pt; + text-decoration: none; + vertical-align: middle; + box-sizing: border-box; + word-wrap: break-word; + word-break: break-all; + /*line-height: 9.75pt; + font-size: 9pt;*/ +} + +.hiprint-printElement-tableTarget-border-all { + border: 1px solid; +} +.hiprint-printElement-tableTarget-border-none { + border: 0px solid; +} +.hiprint-printElement-tableTarget-border-lr { + border-left: 1px solid; + border-right: 1px solid; +} +.hiprint-printElement-tableTarget-border-left { + border-left: 1px solid; +} +.hiprint-printElement-tableTarget-border-right { + border-right: 1px solid; +} +.hiprint-printElement-tableTarget-border-tb { + border-top: 1px solid; + border-bottom: 1px solid; +} +.hiprint-printElement-tableTarget-border-top { + border-top: 1px solid; +} +.hiprint-printElement-tableTarget-border-bottom { + border-bottom: 1px solid; +} + +.hiprint-printElement-tableTarget-border-td-none td { + border: 0px solid; +} +.hiprint-printElement-tableTarget-border-td-all td:not(:nth-last-child(-n+2)) { + border-right: 1px solid; +} +.hiprint-printElement-tableTarget-border-td-all td:not(last-child) { + border-right: 1px solid; +} +.hiprint-printElement-tableTarget-border-td-all td:last-child { + border-left: 1px solid; +} +.hiprint-printElement-tableTarget-border-td-all td:last-child:first-child { + border-left: none; +} + +/*.hiprint-printElement-tableTarget tr,*/ +.hiprint-printElement-tableTarget td { + height: 18pt; +} + +.hiprint-printPaper .hiprint-paperNumber { + font-size: 9pt; +} + +.design .hiprint-printElement-table-handle { + position: absolute; + height: 21pt; + width: 21pt; + background: red; + z-index: 1; +} + +.hiprint-printPaper .hiprint-paperNumber-disabled { + float: right !important; + right: 0 !important; + color: gainsboro !important; +} + +.hiprint-printElement-vline, .hiprint-printElement-hline { + border: 0px none rgb(0, 0, 0); + +} + +.hiprint-printElement-vline { + border-left: 0.75pt solid #000; + border-right: 0px none rgb(0, 0, 0) !important; + border-bottom: 0px none rgb(0, 0, 0) !important; + border-top: 0px none rgb(0, 0, 0) !important; +} + +.hiprint-printElement-hline { + border-top: 0.75pt solid #000; + border-right: 0px none rgb(0, 0, 0) !important; + border-bottom: 0px none rgb(0, 0, 0) !important; + border-left: 0px none rgb(0, 0, 0) !important; +} + +.hiprint-printElement-oval, .hiprint-printElement-rect { + border: 0.75pt solid #000; +} + +.hiprint-text-content-middle { +} + +.hiprint-text-content-middle > div { + display: grid; + align-items: center; +} + +.hiprint-text-content-bottom { +} + +.hiprint-text-content-bottom > div { + display: grid; + align-items: flex-end; +} + +.hiprint-text-content-wrap { +} + +.hiprint-text-content-wrap .hiprint-text-content-wrap-nowrap { + white-space: nowrap; +} + +.hiprint-text-content-wrap .hiprint-text-content-wrap-clip { + white-space: nowrap; + overflow: hidden; + text-overflow: clip; +} + +.hiprint-text-content-wrap .hiprint-text-content-wrap-ellipsis { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +/*hi-grid-row */ +.hi-grid-row { + position: relative; + height: auto; + margin-right: 0; + margin-left: 0; + zoom: 1; + display: block; + box-sizing: border-box; +} + +.hi-grid-row::after, .hi-grid-row::before { + display: table; + content: ''; + box-sizing: border-box; +} + +.hi-grid-col { + display: block; + box-sizing: border-box; + position: relative; + float: left; + flex: 0 0 auto; +} + +.table-grid-row { + margin-left: -0pt; + margin-right: -0pt; +} + +.tableGridColumnsGutterRow { + padding-left: 0pt; + padding-right: 0pt; +} + +.hiprint-gridColumnsFooter { + text-align: left; + clear: both; +} diff --git a/src/api/DesignForm/requestapi.ts b/src/api/DesignForm/requestapi.ts index 93e1e25..dcd1fd3 100644 --- a/src/api/DesignForm/requestapi.ts +++ b/src/api/DesignForm/requestapi.ts @@ -633,3 +633,25 @@ export function gainDataStorceAllField(data: any) { data: data }); } + +//获取有源数据表字段 +/* + VersionId string `json:"versionid"` + FormKey string `json:"formkey"` +*/ +export function getPrintTemplate(data: any) { + return request({ + url: '/printer/customer_form/getPrintTemplate', + method: 'post', + data: data + }); +} + +//获取有源数据表字段 +export function savePrintTemplate(data: any) { + return request({ + url: '/printer/customer_form/savePrintTemplate', + method: 'post', + data: data + }); +} \ No newline at end of file diff --git a/src/assets/logo_text.png b/src/assets/logo_text.png new file mode 100644 index 0000000..bdf9286 Binary files /dev/null and b/src/assets/logo_text.png differ diff --git a/src/assets/print-lock.css b/src/assets/print-lock.css new file mode 100644 index 0000000..82c1404 --- /dev/null +++ b/src/assets/print-lock.css @@ -0,0 +1,352 @@ +@media print { + body { + margin: 0px; + padding: 0px; + } +} + +@page { + margin: 0; +} + +.hiprint-printPaper * { + box-sizing: border-box; + -moz-box-sizing: border-box; /* Firefox */ + -webkit-box-sizing: border-box; /* Safari */ +} + +.hiprint-printPaper *:focus { + outline: -webkit-focus-ring-color auto 0px; +} + +.hiprint-printPaper { + position: relative; + padding: 0 0 0 0; + page-break-after: always; + -webkit-user-select: none; /* Chrome/Safari/Opera */ + -moz-user-select: none; /* Firefox */ + user-select: none; + overflow-x: hidden; + overflow: hidden; +} + +.hiprint-printPaper .hiprint-printPaper-content { + position: relative; +} + +/* 火狐浏览器打印 第一页过后 重叠问题 */ +@-moz-document url-prefix() { + .hiprint-printPaper .hiprint-printPaper-content { + position: relative; + margin-top: 20px; + top: -20px + } +} + +.hiprint-printPaper.design { + overflow: visible; +} + + +.hiprint-printTemplate .hiprint-printPanel { + page-break-after: always; +} + +.hiprint-printPaper, hiprint-printPanel { + box-sizing: border-box; + border: 0px; +} + +.hiprint-printPanel .hiprint-printPaper:last-child { + page-break-after: avoid; +} + +.hiprint-printTemplate .hiprint-printPanel:last-child { + page-break-after: avoid; +} + +.hiprint-printPaper .hideheaderLinetarget { + border-top: 0px dashed rgb(201, 190, 190) !important; +} + +.hiprint-printPaper .hidefooterLinetarget { + border-top: 0px dashed rgb(201, 190, 190) !important; +} + +.hiprint-printPaper.design { + border: 1px dashed rgba(170, 170, 170, 0.7); +} + +.design .hiprint-printElement-table-content, .design .hiprint-printElement-longText-content { + overflow: hidden; + box-sizing: border-box; +} + +.design .resize-panel { + box-sizing: border-box; + border: 1px dotted; +} + +.hiprint-printElement-text { + background-color: transparent; + background-repeat: repeat; + padding: 0 0 0 0; + border: 0.75pt none rgb(0, 0, 0); + direction: ltr; + font-family: 'SimSun'; + font-size: 9pt; + font-style: normal; + font-weight: normal; + padding-bottom: 0pt; + padding-left: 0pt; + padding-right: 0pt; + padding-top: 0pt; + text-align: left; + text-decoration: none; + line-height: 9.75pt; + box-sizing: border-box; + word-wrap: break-word; + word-break: break-all; +} + +.design .hiprint-printElement-text-content { + border: 1px dashed rgb(206, 188, 188); + box-sizing: border-box; +} + +.hiprint-printElement-longText { + background-color: transparent; + background-repeat: repeat; + border: 0.75pt none rgb(0, 0, 0); + direction: ltr; + font-family: 'SimSun'; + font-size: 9pt; + font-style: normal; + font-weight: normal; + padding-bottom: 0pt; + padding-left: 0pt; + padding-right: 0pt; + padding-top: 0pt; + text-align: left; + text-decoration: none; + line-height: 9.75pt; + box-sizing: border-box; + word-wrap: break-word; + word-break: break-all; + /*white-space: pre-wrap*/ +} + + +.hiprint-printElement-table { + background-color: transparent; + background-repeat: repeat; + color: rgb(0, 0, 0); + border-color: rgb(0, 0, 0); + border-style: none; + direction: ltr; + font-family: 'SimSun'; + font-size: 9pt; + font-style: normal; + font-weight: normal; + padding-bottom: 0pt; + padding-left: 0pt; + padding-right: 0pt; + padding-top: 0pt; + text-align: left; + text-decoration: none; + padding: 0 0 0 0; + box-sizing: border-box; + line-height: 9.75pt; +} + +.hiprint-printElement-table thead { + background: #e8e8e8; + font-weight: 700; +} + +table.hiprint-printElement-tableTarget { + width: 100%; +} + +.hiprint-printElement-tableTarget, .hiprint-printElement-tableTarget tr, .hiprint-printElement-tableTarget td { + border-color: rgb(0, 0, 0); + /*border-style: none;*/ + /*border: 1px solid rgb(0, 0, 0);*/ + font-weight: normal; + direction: ltr; + padding-bottom: 0pt; + padding-left: 4pt; + padding-right: 4pt; + padding-top: 0pt; + text-decoration: none; + vertical-align: middle; + box-sizing: border-box; + word-wrap: break-word; + word-break: break-all; + /*line-height: 9.75pt; + font-size: 9pt;*/ +} + +.hiprint-printElement-tableTarget-border-all { + border: 1px solid; +} +.hiprint-printElement-tableTarget-border-none { + border: 0px solid; +} +.hiprint-printElement-tableTarget-border-lr { + border-left: 1px solid; + border-right: 1px solid; +} +.hiprint-printElement-tableTarget-border-left { + border-left: 1px solid; +} +.hiprint-printElement-tableTarget-border-right { + border-right: 1px solid; +} +.hiprint-printElement-tableTarget-border-tb { + border-top: 1px solid; + border-bottom: 1px solid; +} +.hiprint-printElement-tableTarget-border-top { + border-top: 1px solid; +} +.hiprint-printElement-tableTarget-border-bottom { + border-bottom: 1px solid; +} + +.hiprint-printElement-tableTarget-border-td-none td { + border: 0px solid; +} +.hiprint-printElement-tableTarget-border-td-all td:not(:nth-last-child(-n+2)) { + border-right: 1px solid; +} +.hiprint-printElement-tableTarget-border-td-all td:not(last-child) { + border-right: 1px solid; +} +.hiprint-printElement-tableTarget-border-td-all td:last-child { + border-left: 1px solid; +} +.hiprint-printElement-tableTarget-border-td-all td:last-child:first-child { + border-left: none; +} + +/*.hiprint-printElement-tableTarget tr,*/ +.hiprint-printElement-tableTarget td { + height: 18pt; +} + +.hiprint-printPaper .hiprint-paperNumber { + font-size: 9pt; +} + +.design .hiprint-printElement-table-handle { + position: absolute; + height: 21pt; + width: 21pt; + background: red; + z-index: 1; +} + +.hiprint-printPaper .hiprint-paperNumber-disabled { + float: right !important; + right: 0 !important; + color: gainsboro !important; +} + +.hiprint-printElement-vline, .hiprint-printElement-hline { + border: 0px none rgb(0, 0, 0); + +} + +.hiprint-printElement-vline { + border-left: 0.75pt solid #000; + border-right: 0px none rgb(0, 0, 0) !important; + border-bottom: 0px none rgb(0, 0, 0) !important; + border-top: 0px none rgb(0, 0, 0) !important; +} + +.hiprint-printElement-hline { + border-top: 0.75pt solid #000; + border-right: 0px none rgb(0, 0, 0) !important; + border-bottom: 0px none rgb(0, 0, 0) !important; + border-left: 0px none rgb(0, 0, 0) !important; +} + +.hiprint-printElement-oval, .hiprint-printElement-rect { + border: 0.75pt solid #000; +} + +.hiprint-text-content-middle { +} + +.hiprint-text-content-middle > div { + display: grid; + align-items: center; +} + +.hiprint-text-content-bottom { +} + +.hiprint-text-content-bottom > div { + display: grid; + align-items: flex-end; +} + +.hiprint-text-content-wrap { +} + +.hiprint-text-content-wrap .hiprint-text-content-wrap-nowrap { + white-space: nowrap; +} + +.hiprint-text-content-wrap .hiprint-text-content-wrap-clip { + white-space: nowrap; + overflow: hidden; + text-overflow: clip; +} + +.hiprint-text-content-wrap .hiprint-text-content-wrap-ellipsis { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +/*hi-grid-row */ +.hi-grid-row { + position: relative; + height: auto; + margin-right: 0; + margin-left: 0; + zoom: 1; + display: block; + box-sizing: border-box; +} + +.hi-grid-row::after, .hi-grid-row::before { + display: table; + content: ''; + box-sizing: border-box; +} + +.hi-grid-col { + display: block; + box-sizing: border-box; + position: relative; + float: left; + flex: 0 0 auto; +} + +.table-grid-row { + margin-left: -0pt; + margin-right: -0pt; +} + +.tableGridColumnsGutterRow { + padding-left: 0pt; + padding-right: 0pt; +} + +.hiprint-gridColumnsFooter { + text-align: left; + clear: both; +} diff --git a/src/components/DesignForm/app/index copy.vue b/src/components/DesignForm/app/index copy.vue deleted file mode 100644 index fa3d145..0000000 --- a/src/components/DesignForm/app/index copy.vue +++ /dev/null @@ -1,2614 +0,0 @@ - - - - diff --git a/src/components/DesignForm/app/index.vue b/src/components/DesignForm/app/index.vue index 2bc21bb..770d4b9 100644 --- a/src/components/DesignForm/app/index.vue +++ b/src/components/DesignForm/app/index.vue @@ -43,7 +43,10 @@ import { } from "@/api/taskapi/management"; import { formatNumber } from "@/api/DesignForm/utils"; - +import printHtmlRender from '../printHtmlRender.vue' +import {fieldTree,PageConfig} from '../printHtmlRender.vue' +import {printElement} from "@/views/sysworkflow/lowcodepage/appPage/appPageForm/printHtmlDom.js" +import {getPrintTemplate} from '@/api/DesignForm/requestapi' //引入组件 import FormPageCont from "@/components/DesignForm/tableListPage/formPageCont.vue"; import TableFlow from "@/views/sysworkflow/lowcodepage/pageFlow/appTableFlow.vue"; @@ -70,6 +73,7 @@ const props = withDefaults( searchData?: attrButton[]; config?: FormPageConfig|any; formId?: string; + appKey?: string; beforeRequest?: (params: any, rout: any) => any; afterResponse?: (result: any) => any | string; beforeDelete?: (params: any, route: any) => any; @@ -83,6 +87,7 @@ const props = withDefaults( delKey?: string; // 删除标识 lookPageIsShow?: boolean; versionid?: string; + formKey?:string; signCode?: string; pickAppMenu?: any; versiontitle?: string; @@ -1609,6 +1614,91 @@ const lookPageInfo = (val: any) => { drawerWith.value = container.value?.clientWidth; lookPageInfoIsShow.value = true; }; + + +/****************表单打印功能************************/ +const printRenderMode = ref(false); +const printRenderTree: Ref = ref([]); +const printPage = async (row: any) => { + let data:any[]=[] + let _pageConfig:PageConfig + let title:string="表单"; + await getPrintTemplate({"versionid":props.versionid,"formkey":props.appKey}).then(resp=>{ + title=resp.data.title + if(resp.data.formtemplatejson!=""){ + data=JSON.parse(resp.data.formtemplatejson) + }else{ + alert("请先创建打印模板!") + return + } + + if(resp.data.pageconfigjson!=""){ + _pageConfig=JSON.parse(resp.data.pageconfigjson) + if(_pageConfig.founder!=""){ + _pageConfig.founder=row[_pageConfig.founder] + } + if(_pageConfig.founderTime!=""){ + _pageConfig.founderTime=row[_pageConfig.founderTime] + } + if(_pageConfig.deptOrg!=""){ + _pageConfig.deptOrg=row[_pageConfig.deptOrg] + } + if(_pageConfig.serialNumber!=""){ + _pageConfig.serialNumber=row[_pageConfig.serialNumber] + } + } + }) + + let qrstr=`https://wab.hxgk.group/#/form_table/taskInfo?id=${props.formId}&key=${props.appKey}& + formid=${props.versionid}&formKey=${props.formKey}&state=2` + data.forEach(node=>{ + deepLoopForm(node,row) + }) + printRenderTree.value=data + printRenderMode.value = true; + ElMessageBox({ + message: () => h('div',{style:{ width:'1200px',display:'flex','flex-direction':'column'}},[ + h(ElButton, { + type:"primary", + style: "margin:10px 10px 5px auto;", + onClick: () => { + printElement("printContainer") + } + },'打印表单'), + h('div',{style:{ border: '1px solid black', width: 'fit-content', margin: '5px','align-self': 'center'}},[ + h(printHtmlRender,{ + name:title, + fieldTree:printRenderTree.value, + pageConfig:_pageConfig, + qrcode:qrstr, + }) + ]) + ]), + showConfirmButton:false, + customStyle: { '--el-messagebox-width':'1300px',padding:'10px'}, + }).then(() => { + }) +}; + + +const deepLoopForm=(node:fieldTree, row: Record)=>{ + if(Array.isArray(node)){ + node.forEach(item=>{deepLoopForm(item,row)}) + return + } + + if(node.field!=""){ + let rnode:Object; + if (row.hasOwnProperty(node.field!)){// 有这个字段 + if (node.type=="table" || node.type=="tabs"){ + node.data=row[node.field!] + }else{ + node.field=row[node.field!] + } + } + } + } + /** @ 作者: 秦东 @ 时间: 2024-04-05 11:29:50 @@ -2261,6 +2351,21 @@ const isObject = (obj: any) => { class="fa fa-edit" /> + + + + + +import QRCode from 'qrcode'; +import logourl from "@/assets/logo_text.png"; +import { useUserStore } from '@/store/modules/user'; + +export interface fieldTree{ + field?:string; + name?:string; + type:string; + checked?:number; + data?:[]; + child?:fieldTree[] +} + +export interface PageConfig{ + width:string; + height:string; + horizontal:string;//横向 + pagesize:string; + + //页脚页眉 + pagebrow:string[]; + founder:string; + founderTime:string; + deptOrg:string; + serialNumber:string; + qrcode:boolean; +} + +const props = withDefaults(defineProps<{ + name:string, + pageConfig:PageConfig, + fieldTree:fieldTree[], + qrcode?:string, +}>(),{}) + +const qrdata=ref("") +const userName=useUserStore().nickname; + +function parseDataPicker(val:string){ + if(val==""|| val.match(/[a-z]/) ) return val; + let str=new Date(parseInt(val)).toISOString() + return str.slice(0,10)+" "+str.slice(11,16) +} + +const generateQrCode= ()=>{ + var opts = { + errorCorrectionLevel: 'M', + type: 'image/png', + quality: 0.3, + margin: 1, + color: { + dark:"#000", + light:"#fff" + } + } + + QRCode.toDataURL(props.qrcode, opts, function (err, url) { + if (err) throw err + qrdata.value=url + }) +} + + + + + + + diff --git a/src/components/DesignForm/tableListPage/index copy.vue b/src/components/DesignForm/tableListPage/index copy.vue deleted file mode 100644 index 7a91c76..0000000 --- a/src/components/DesignForm/tableListPage/index copy.vue +++ /dev/null @@ -1,2505 +0,0 @@ - - - - diff --git a/src/components/DesignForm/tableListPage/index.vue b/src/components/DesignForm/tableListPage/index.vue index 6f8d2ae..6d9de3c 100644 --- a/src/components/DesignForm/tableListPage/index.vue +++ b/src/components/DesignForm/tableListPage/index.vue @@ -28,7 +28,7 @@ import { checkboxUnit, orgDeptUnit, } from "@/api/DesignForm/fieldUnit"; -import type { FormInstance, FormRules } from "element-plus"; +import type { FormInstance, FormRules,ElButton } from "element-plus"; import { gainFormPageListCont } from "@/api/DesignForm/requestapi"; import { Picture, InfoFilled, QuestionFilled } from "@element-plus/icons-vue"; import request from "@/utils/request"; @@ -38,6 +38,10 @@ import { ElLoading, ElMessage, ElNotification } from "element-plus"; import { softDeletion, retractRunWorkFlow, recalSendMsg } from "@/api/taskapi/management"; import { echatsViews } from "@/api/DesignForm/types"; import { formatNumber } from "@/api/DesignForm/utils"; +import { Ref } from "vue"; +import printHtmlRender from '../printHtmlRender.vue' +import {fieldTree,PageConfig} from '../printHtmlRender.vue' +import {printElement} from "@/views/sysworkflow/lowcodepage/appPage/appPageForm/printHtmlDom.js" //引入组件 import FormPageCont from "@/components/DesignForm/tableListPage/formPageCont.vue"; import TableFlow from "@/views/sysworkflow/lowcodepage/pageFlow/tableFlow.vue"; @@ -49,6 +53,8 @@ import CalendarPage from "@/components/DesignForm/app/calendar/calendar1/calenda import SearchSelect from "@/components/DesignForm/app/calendar/selectSearch.vue"; import ContainerPath from "@/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/container.vue"; import SeeContChart from "@/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/seeContChart.vue"; +import {getPrintTemplate} from '@/api/DesignForm/requestapi' +import { display } from "html2canvas/dist/types/css/property-descriptors/display"; const props = withDefaults( defineProps<{ @@ -56,6 +62,7 @@ const props = withDefaults( searchData?: attrButton[]; config: FormPageConfig; formId?: string; + appKey?: string; beforeRequest?: (params: any, rout: any) => any; afterResponse?: (result: any) => any | string; beforeDelete?: (params: any, route: any) => any; @@ -69,6 +76,7 @@ const props = withDefaults( delKey?: string; // 删除标识 lookPageIsShow?: boolean; versionid?: string; + formKey?:string; versiontitle?: string; viewPage?: viewPageType; formBasicConfig?: any; @@ -1335,6 +1343,89 @@ const lookPageInfo = (val: any) => { drawerWith.value = container.value?.clientWidth; lookPageInfoIsShow.value = true; }; + +/****************表单打印功能************************/ +const printRenderMode = ref(false); +const printRenderTree: Ref = ref([]); +const printPage = async (row: any) => { + let data:any[]=[] + let _pageConfig:PageConfig + let title:string="表单"; + //这里appkey和formkey 有些乱,由于历史遗留问题,不好区分。。。 + await getPrintTemplate({"versionid":props.versionid,"formkey":props.appKey}).then(resp=>{ + title=resp.data.title + if(resp.data.formtemplatejson!=""){ + data=JSON.parse(resp.data.formtemplatejson) + } + if(resp.data.pageconfigjson!=""){ + _pageConfig=JSON.parse(resp.data.pageconfigjson) + if(_pageConfig.founder!=""){ + _pageConfig.founder=row[_pageConfig.founder] + } + if(_pageConfig.founderTime!=""){ + _pageConfig.founderTime=row[_pageConfig.founderTime] + } + if(_pageConfig.deptOrg!=""){ + _pageConfig.deptOrg=row[_pageConfig.deptOrg] + } + if(_pageConfig.serialNumber!=""){ + _pageConfig.serialNumber=row[_pageConfig.serialNumber] + } + } + }) + + let qrstr=`https://wab.hxgk.group/#/form_table/taskInfo?id=${props.formId}&key=${props.appKey}& + formid=${props.versionid}&formKey=${props.formKey}&state=2` + + data.forEach(node=>{ + deepLoopForm(node,row) + }) + printRenderTree.value=data + printRenderMode.value = true; + ElMessageBox({ + message: () => h('div',{style:{ width:'1200px',display:'flex','flex-direction':'column'}},[ + h(ElButton, { + type:"primary", + style: "margin:10px 10px 5px auto;", + onClick: () => { + printElement("printContainer") + } + },'打印表单'), + h('div',{style:{ border: '1px solid black', width: 'fit-content', margin: '5px','align-self': 'center'}},[ + h(printHtmlRender,{ + name:title, + fieldTree:printRenderTree.value, + pageConfig:_pageConfig, + qrcode:qrstr + }) + ]) + ]), + showConfirmButton:false, + customStyle: { '--el-messagebox-width':'1300px',padding:'10px'}, + }).then(() => { + }) + +}; + + +const deepLoopForm=(node:fieldTree, row: Record)=>{ + if(Array.isArray(node)){ + node.forEach(item=>{deepLoopForm(item,row)}) + return + } + + if(node.field!=""){ + let rnode:Object; + if (row.hasOwnProperty(node.field!)){// 有这个字段 + if (node.type=="table" || node.type=="tabs"){ + node.data=row[node.field!] + }else{ + node.field=row[node.field!] + } + } + } + } + /** @ 作者: 秦东 @ 时间: 2024-04-05 11:29:50 @@ -1946,7 +2037,6 @@ const isObject = (obj: any) => { align="center" > @@ -2005,6 +2095,20 @@ const isObject = (obj: any) => { /> + + + + { - { - 表单预览 + 表单预览++ diff --git a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/aiPage.vue b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/aiPage.vue index c97fd4c..2f588e2 100644 --- a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/aiPage.vue +++ b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/aiPage.vue @@ -141,9 +141,7 @@ const sendPickTracn = () => { AI触发条件设置 - 发布AI触发条件 + 发布AI触发条件 - 欢迎使用 {{ props.appCont.appName }}
+ {{ props.appCont.appName }}