Browse Source

Merge branch 'lwx_16'

lwx_v17
hreenshan112 10 months ago
parent
commit
fb36d82978
  1. 512
      src/components/DesignForm/app/index.vue
  2. 8
      src/components/DesignForm/formControlPropertiNew.vue
  3. 377
      src/components/DesignForm/tableListPage/index.vue
  4. 1
      src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue
  5. 2
      src/views/sysworkflow/lowcodepage/runApp/runAppForm.vue

512
src/components/DesignForm/app/index.vue

@ -27,7 +27,10 @@ import {
checkboxUnit, checkboxUnit,
orgDeptUnit, orgDeptUnit,
} from "@/api/DesignForm/fieldUnit"; } from "@/api/DesignForm/fieldUnit";
import type { FormInstance, FormRules, ElNotification } from "element-plus"; import type { FormInstance, FormRules } from "element-plus";
import { ElLoading,ElMessage,ElNotification } from 'element-plus'
import html2canvas from 'html2canvas';
import JSZip, { forEach } from 'jszip';
import { gainFormPageListCont } from "@/api/DesignForm/requestapi"; import { gainFormPageListCont } from "@/api/DesignForm/requestapi";
import { Picture, InfoFilled, QuestionFilled } from "@element-plus/icons-vue"; import { Picture, InfoFilled, QuestionFilled } from "@element-plus/icons-vue";
import request from "@/utils/request"; import request from "@/utils/request";
@ -69,6 +72,8 @@ const props = withDefaults(
pickAppMenu?: any; pickAppMenu?: any;
versiontitle?: string; versiontitle?: string;
viewPage?: viewPageType; viewPage?: viewPageType;
formBasicConfig?: any;
fieldsDetailList?:any;
}>(), }>(),
{ {
showPage: true, showPage: true,
@ -108,6 +113,12 @@ const props = withDefaults(
viewPage: () => { viewPage: () => {
return []; return [];
}, },
formBasicConfig: () => {
return {};
},
fieldsDetailList: () => {
return {};
},
} }
); );
const emits = defineEmits<{ const emits = defineEmits<{
@ -214,6 +225,235 @@ const resetFields = (formEl: FormInstance | undefined) => {
}); });
} }
}; };
//20250117
const qrCodesPrintDialogFlag = ref(false)
let tableRefs = reactive({});
const tablesData = ref({})
function getDetailQrCodes(val:any) {
return request({
url: "/javasys/lowCode/QrCode/getDetailQrCodes",
method: "post",
data: {
cfid: props.formId,
idArray:val,
settings:props.formBasicConfig,
},
});
}
function modifyFieldsMap4(fieldsMap: any): Array<{ key: string, value: string }> {
let result: Array<{ key: string, value: string }> = [];
// 使 Object.entries
for (const [key, value] of Object.entries(fieldsMap)) {
let parts = value.split("!@#@!");
if (parts.length === 2) {
result.push({ key: parts[0], value: parts[1] });
} else {
// 使
result.push({ key, value });
}
}
return result;
}
//
const isButton1Disabled = ref(false);
const isButton2Disabled = ref(false);
async function downloadTables() {
isButton1Disabled.value = true;
isButton2Disabled.value = true;
const loadingInstance = ElLoading.service({
fullscreen: true,
text: '正在生成图片,请稍候...' //
});
//ElMessage('This is a message.')
const zip = new JSZip();
//console.log(tableRefs)
for (const [tableKey, element] of Object.entries(tableRefs)) {
try {
const canvas = await html2canvas(element);
const dataUrl = canvas.toDataURL('image/png');
const byteString = atob(dataUrl.split(',')[1]);
const mimeString = dataUrl.split(',')[0].split(':')[1].split(';')[0];
const ab = new ArrayBuffer(byteString.length);
const ia = new Uint8Array(ab);
for (let i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
const blob = new Blob([ab], { type: mimeString });
zip.file(`${props.formBasicConfig.formName}-${tableKey}.png`, blob);
} catch (error) {
console.error(`Error converting ${tableKey} to image:`, error);
}
}
zip.generateAsync({ type: 'blob' }).then(function(content) {
const now = new Date();
const formattedDate = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, '0')}${String(now.getDate()).padStart(2, '0')}_${String(now.getHours()).padStart(2, '0')}${String(now.getMinutes()).padStart(2, '0')}${String(now.getSeconds()).padStart(2, '0')}`;
const fileName = `${props.formBasicConfig.formName}-${formattedDate}.zip`;
const link = document.createElement('a');
link.href = URL.createObjectURL(content);
link.download = fileName;
loadingInstance.close()
link.click();
tableRefs = {}
//
isButton1Disabled.value = false;
isButton2Disabled.value = false;
});
}
function closeQrDownload(){
qrCodesPrintDialogFlag.value = false
tableRefs = {}
//console.log(tableRefs)
}
let asfs: any[] = [];
let radios: any[] = [];
let checkboxs: any[] = [];
let switchs: any[] = [];
let selects: any[] = [];
let tables: any[] = [];
function getAsfs() {
//setTimeout(() => {
let dataList = ref({});
dataList.value = props.fieldsDetailList
if (dataList && Array.isArray(dataList.value) && dataList.value.length > 0) {
for (let i = 0; i < dataList.value.length; i++) {
if (dataList.value[i].type == "associatedForms") {
asfs.push(dataList.value[i]);
}else if(dataList.value[i].type == "radio"){
radios.push(dataList.value[i])
} else if(dataList.value[i].type == "checkbox"){
checkboxs.push(dataList.value[i])
} else if(dataList.value[i].type == "switch"){
switchs.push(dataList.value[i])
} else if(dataList.value[i].type == "select"){
selects.push(dataList.value[i])
} else if (
dataList.value[i].type == "card" ||
dataList.value[i].type == "flex" ||
dataList.value[i].type == "div" ||
dataList.value[i].type == "table"
) {
if (dataList.value[i].type == "table") {
tables.push(dataList.value[i]);
}
dataList.value[i].list.forEach((element: any) => {
if (element.type == "associatedForms") {
asfs.push(element);
}else if(element.type == "radio"){
radios.push(element)
}else if(element.type == "checkbox"){
checkboxs.push(element)
}else if(element.type == "switch"){
switchs.push(element)
}else if(element.type == "select"){
selects.push(element)
}
});
} else if (dataList.value[i].type == "grid") {
let columns = JSON.parse(JSON.stringify(dataList.value[i].columns));
if (columns.length > 0) {
for (let z = 0; z < columns.length; z++) {
for (let x = 0; x < columns[z].list.length; x++) {
let a = JSON.parse(JSON.stringify(columns[z].list[x]));
if (a.type == "associatedForms") {
asfs.push(a);
}else if(a.type == "radio"){
radios.push(a)
}else if(a.type == "checkbox"){
checkboxs.push(a)
}else if(a.type == "switch"){
switchs.push(a)
}else if(a.type == "select"){
selects.push(a)
}
}
}
}
} else if (dataList.value[i].type == "tabs") {
//tabsflextable
let columns = JSON.parse(JSON.stringify(dataList.value[i].columns));
if (columns.length > 0) {
for (let z = 0; z < columns.length; z++) {
for (let x = 0; x < columns[z].list.length; x++) {
let a = JSON.parse(JSON.stringify(columns[z].list[x]));
if (a.type == "associatedForms") {
asfs.push(a);
}else if(a.type == "radio"){
radios.push(a)
}else if(a.type == "checkbox"){
checkboxs.push(a)
}else if(a.type == "switch"){
switchs.push(a)
}else if(a.type == "select"){
selects.push(a)
}else if (a.type == "flex" || a.type == "table") {
if (a.type == "table") {
tables.push(dataList.value[i]);
}
if (a.list.length > 0) {
for (let m = 0; m < a.list.length; m++) {
let q = JSON.parse(JSON.stringify(a.list[m]));
if (q.type == "associatedForms") {
asfs.push(q);
}else if(q.type == "radio"){
radios.push(q)
}else if(q.type == "checkbox"){
checkboxs.push(q)
}else if(q.type == "switch"){
switchs.push(q)
}else if(q.type == "select"){
selects.push(q)
}
}
}
}
}
}
}
}
}
}
//}, 500);
}
function convertStringToArray(str: string) {
if (typeof str!== 'string') {
throw new Error('Input must be a string.');
}
if (str === '') {
return [];
}
//
str = str.slice(1, -1);
if (str === '') {
return [];
}
let parts = str.split(',');
return parts.map(part => parseFloat(part));
}
//liwenxuan 20250120 end
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2024-04-01 11:36:07 @ 时间: 2024-04-01 11:36:07
@ -226,8 +466,192 @@ const setUpClick = (val: string, id: string) => {
drawerWith.value = container.value?.clientWidth; drawerWith.value = container.value?.clientWidth;
openTaskDrawer.value = true; openTaskDrawer.value = true;
} else if(val.key == "showQrCode"){ } else if(val.key == "showQrCode"){
//alert(val)
console.log(idList)
//liwenxuan 20250114 start
//,
let idArray = state.selectionChecked.map(item => item.id);
if(idArray.length>0){
const loadingInstance1 = ElLoading.service({
fullscreen: true,
text: '正在生成二维码,请稍候...' //
});
//console.log(props.formBasicConfig)
//
let getDetailQrCodesData: any = {}
let currentFieldsMapArrObj: any = {}
getDetailQrCodes(idArray).then(({ data }) => {
getDetailQrCodesData = JSON.parse(JSON.stringify(data));
if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"){
let asfQueryParams1: any[] = [];
for (let key in getDetailQrCodesData) {
currentFieldsMapArrObj[key] = getDetailQrCodesData[key]
if (getDetailQrCodesData.hasOwnProperty(key)) {
let currentFieldsMap = getDetailQrCodesData[key].fieldsMap
//console.log(currentFieldsMap)
//
for (let attr_name in currentFieldsMap) {
if (currentFieldsMap.hasOwnProperty(attr_name)) {
//console.log("attr_name------"+attr_name)
//console.log(`: ${attr_name}, : ${currentFieldsMap[attr_name]}`);
radios.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
let optionsHasCurrentValue = false
element.options.forEach((element1: any) => {
if(toConvertValue==element1.value){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label
optionsHasCurrentValue = true
}
});
if(optionsHasCurrentValue==false){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+""
}
}
});
selects.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
let optionsHasCurrentValue = false
element.options.forEach((element1: any) => {
if(toConvertValue==element1.value){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label
optionsHasCurrentValue = true
}
});
if(optionsHasCurrentValue==false){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+""
}
}
});
switchs.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
if(toConvertValue=="0"){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"禁用"
}else{
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"启用"
}
}
});
checkboxs.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
let toConvertArr = convertStringToArray(toConvertValue);
let toAddStr = ""
if(toConvertArr.length>0){
toConvertArr.forEach((element1: any) => {
element.options.forEach((element2: any) => {
if(element1==element2.value){
toAddStr = toAddStr+element2.label+","
}
});
});
toAddStr = toAddStr.slice(0, -1)
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+toAddStr
}
}
});
asfs.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
if(toConvertValue.length>0){
//console.log(element)
let fieldCount = 0;//>0field
asfQueryParams1.forEach((item1: any) => {
//field asfQueryParamsItem1,fieldasfQueryParamsItem1.asfToSelectIds1asfMasterAndAsfId1
// pushasfQueryParamsItem1
if(item1.field==element.name){
fieldCount++
}
});
if(fieldCount>0){
//
//field
asfQueryParams1.forEach((item1: any) => {
if(item1.field==element.name){
let asfMasterAndAsfId1: any = {};
asfMasterAndAsfId1.asfId = toConvertValue+"";
asfMasterAndAsfId1.asfMasterId = key+"";
item1.asfToSelectIds.push(asfMasterAndAsfId1)
}
});
}else{
//
let asfQueryParamsItem1: any = {};
asfQueryParamsItem1.formId = element.control.formid;
asfQueryParamsItem1.field = element.name;
let asfToSelectIds1: any[] = [];
asfQueryParamsItem1.asfToSelectIds = asfToSelectIds1;
let asfMasterAndAsfId1: any = {};
asfMasterAndAsfId1.asfId = toConvertValue+"";
asfMasterAndAsfId1.asfMasterId = key+"";
asfToSelectIds1.push(asfMasterAndAsfId1)
asfQueryParams1.push(asfQueryParamsItem1)
}
}
}
})
}
}
setTimeout(()=>{
getDetailQrCodesData[key].fieldsMap = modifyFieldsMap4(currentFieldsMap)
},800)
}
}
getAsfDataTitlesByIds(asfQueryParams1).then(({ data }) => {
let getAsfDataTitlesByIdsData = JSON.parse(JSON.stringify(data));
for (let key in currentFieldsMapArrObj) {
if (getDetailQrCodesData.hasOwnProperty(key)) {
let currentFieldsMap = getDetailQrCodesData[key].fieldsMap
getAsfDataTitlesByIdsData.forEach((element1: any) => {
element1.list.forEach((element2: any) => {
if(key==element2.asfMasterId){
currentFieldsMap[element1.field] = currentFieldsMap[element1.field].split("!@#@!")[0]+"!@#@!"+element2.label
}
})
})
}
}
})
setTimeout(()=>{
tablesData.value = getDetailQrCodesData
},810)
setTimeout(()=>{
loadingInstance1.close()
qrCodesPrintDialogFlag.value = true
},820)
}else if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="1"){
//fieldsMap = null
tablesData.value = getDetailQrCodesData
qrCodesPrintDialogFlag.value = true
loadingInstance1.close()
}
})/* .finally(()=>{
loadingInstance1.close()
qrCodesPrintDialogFlag.value = true
}) */
}else{
alert("未选中任何一条,请先选择")
}
//liwenxuan 20250114 end
}else { }else {
if (idList.value.length > 0) { if (idList.value.length > 0) {
ElMessageBox.confirm("确认删除此数据项?删除后不可恢复!", "警告", { ElMessageBox.confirm("确认删除此数据项?删除后不可恢复!", "警告", {
@ -459,6 +883,13 @@ const getPageData = () => {
}) })
.finally(() => { .finally(() => {
state.loading = false; state.loading = false;
asfs = [];
radios = [];
checkboxs = [];
switchs = [];
selects = [];
tables = [];
getAsfs()
}); });
} }
}; };
@ -514,7 +945,8 @@ const asfGetPageData = (asfFormId: any, asfToSelectMastersKey: any) => {
let asfToSelectIds = []; let asfToSelectIds = [];
for (let i = 0; i < data.data.list.length; i++) { for (let i = 0; i < data.data.list.length; i++) {
let asfMasterAndAsfId: any = {}; let asfMasterAndAsfId: any = {};
asfMasterAndAsfId.asfId = data.data.list[i][asfDetails[j].field]; //asfMasterAndAsfId.asfId = data.data.list[i][asfDetails[j].field];
asfMasterAndAsfId.asfId = data.data.list[i].id
asfMasterAndAsfId.asfMasterId = data.data.list[i].id; asfMasterAndAsfId.asfMasterId = data.data.list[i].id;
asfToSelectIds.push(asfMasterAndAsfId); asfToSelectIds.push(asfMasterAndAsfId);
@ -564,9 +996,12 @@ const asfGetPageData = (asfFormId: any, asfToSelectMastersKey: any) => {
/* state.loading = false; */ /* state.loading = false; */
// //
setTimeout(()=>{
tablePageClass.value = 4; tablePageClass.value = 4;
drawerWith.value = container.value?.clientWidth; drawerWith.value = container.value?.clientWidth;
asflookPageInfoIsShow.value = true; asflookPageInfoIsShow.value = true;
},500)
}); });
}; };
@ -619,6 +1054,7 @@ onMounted(() => {
nextTick(() => { nextTick(() => {
drawerWith.value = container.value?.clientWidth; drawerWith.value = container.value?.clientWidth;
}); });
getAsfs()
}); });
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ -1495,6 +1931,65 @@ const transformOption = (val: string | number, type?: string) => {
@searchquery="getListData" @searchquery="getListData"
/> />
</div> </div>
<!-- 2025 liwenxuan 二维码打印 -->
<el-dialog
v-model="qrCodesPrintDialogFlag"
class="glxxsztc"
top="150px"
:close-on-click-modal="false"
title="生成的二维码"
:show-close="false"
style="margin-top: 10px"
width="50%"
>
<div v-if="formBasicConfig.qrCodePrintStyle == '2'" style="min-height: 50px; max-height: 750px; overflow-y: auto">
<div
v-for="(tableData, tableKey) in tablesData"
:id="tableKey"
:key="tableKey"
:ref="(el: any) => { if (el) tableRefs[tableKey] = el }"
style="margin-bottom: 30px; width: 95%;"
>
<table>
<tr>
<th style="font-weight: bold; font-size:medium;" colspan="2">{{ tablesData[tableKey].appName }}-{{ tablesData[tableKey].formName }}</th>
<th rowspan="6"><img :src="tableData.bufferedImage" alt="二维码" width="auto" height="100%"></th>
</tr>
<tr v-for="(item, fIndex) in tableData.fieldsMap" :key="fIndex">
<th>{{ item.key }}</th>
<td>{{ item.value }}</td>
</tr>
</table>
</div>
</div>
<div v-if="formBasicConfig.qrCodePrintStyle == '1'" style="display: flex; flex-direction: column; align-items: center; min-height: 50px; max-height: 750px; overflow-y: auto">
<div
v-for="(tableData, tableKey) in tablesData"
:id="tableKey"
:key="tableKey"
:ref="(el: any) => { if (el) tableRefs[tableKey] = el }"
style="margin-bottom: 30px; width: 400px;"
>
<table >
<tr>
<th style="font-weight: bold; font-size:medium;" colspan="1">{{ tablesData[tableKey].appName }}-{{ tablesData[tableKey].formName }}-{{ tablesData[tableKey].dataTitle }}</th>
</tr>
<tr>
<th ><img :src="tableData.bufferedImage" alt="二维码" width="auto" height="100%"></th>
</tr>
</table>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button :disabled="isButton1Disabled" type="primary" plain @click="downloadTables">下载</el-button>
<el-button :disabled="isButton2Disabled" type="primary" plain @click="closeQrDownload">
确定
</el-button>
</div>
</template>
</el-dialog>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.rowBox { .rowBox {
@ -1567,4 +2062,13 @@ const transformOption = (val: string | number, type?: string) => {
.demo-image__error .image-slot .el-icon { .demo-image__error .image-slot .el-icon {
font-size: 30px; font-size: 30px;
} }
table {
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid black;
padding: 8px;
}
</style> </style>

8
src/components/DesignForm/formControlPropertiNew.vue

@ -2455,7 +2455,7 @@ function getAssociatedFormsCurrentFieldTree1() {
let resDataExceptSystemFields = JSON.parse(JSON.stringify(data.children)); let resDataExceptSystemFields = JSON.parse(JSON.stringify(data.children));
let currentFormChildTableFields = JSON.parse(JSON.stringify(data.children)); let currentFormChildTableFields = JSON.parse(JSON.stringify(data.children));
let resDataNoTable = JSON.parse(JSON.stringify(data.children)); let resDataNoTable = JSON.parse(JSON.stringify(data.children));
let resDataNoTableNoAsf = JSON.parse(JSON.stringify(data.children));
resDataExceptSystemFields = removeFirstNumElements(resDataExceptSystemFields, 8); resDataExceptSystemFields = removeFirstNumElements(resDataExceptSystemFields, 8);
resDataExceptSystemFields.forEach((element: any) => { resDataExceptSystemFields.forEach((element: any) => {
if (element.type == "table") { if (element.type == "table") {
@ -2502,15 +2502,19 @@ function getAssociatedFormsCurrentFieldTree1() {
resDataNoTable = resDataNoTable.filter( resDataNoTable = resDataNoTable.filter(
(item: { type: string | null }) => item.type != "table" (item: { type: string | null }) => item.type != "table"
); );
resDataNoTableNoAsf = resDataNoTable.filter(
(item: { type: string | null }) => item.type != "associatedForms"&&item.type != "table"&&item.type != "checkbox"
);
associatedFormsCurrentFormFieldTreeNoTable.value = [ associatedFormsCurrentFormFieldTreeNoTable.value = [
{ {
id: "rootid_" + data.label, id: "rootid_" + data.label,
label: "当前表单-" + data.treeAttrs.show, label: "当前表单-" + data.treeAttrs.show,
children: [...resDataNoTable], children: [...resDataNoTableNoAsf],
treeAttrs: data.treeAttrs, treeAttrs: data.treeAttrs,
}, },
]; ];
associatedFormsCurrentFormFieldTreeNoTable1.value = [...resDataNoTable] associatedFormsCurrentFormFieldTreeNoTable1.value = [...resDataNoTable]
let resDataForGlxxsz = ref(data.children.slice(8)); let resDataForGlxxsz = ref(data.children.slice(8));

377
src/components/DesignForm/tableListPage/index.vue

@ -27,13 +27,13 @@ import {
checkboxUnit, checkboxUnit,
orgDeptUnit, orgDeptUnit,
} from "@/api/DesignForm/fieldUnit"; } from "@/api/DesignForm/fieldUnit";
import type { FormInstance, FormRules, ElNotification } from "element-plus"; import type { FormInstance, FormRules } from "element-plus";
import { gainFormPageListCont } from "@/api/DesignForm/requestapi"; import { gainFormPageListCont } from "@/api/DesignForm/requestapi";
import { Picture, InfoFilled, QuestionFilled } from "@element-plus/icons-vue"; import { Picture, InfoFilled, QuestionFilled } from "@element-plus/icons-vue";
import request from "@/utils/request"; import request from "@/utils/request";
import html2canvas from 'html2canvas'; import html2canvas from 'html2canvas';
import JSZip from 'jszip'; import JSZip, { forEach } from 'jszip';
import { ElLoading,ElMessage } from 'element-plus' import { ElLoading,ElMessage,ElNotification } from 'element-plus'
import { softDeletion, retractRunWorkFlow } from "@/api/taskapi/management"; import { softDeletion, retractRunWorkFlow } from "@/api/taskapi/management";
import { formatNumber } from "@/api/DesignForm/utils"; import { formatNumber } from "@/api/DesignForm/utils";
@ -69,6 +69,7 @@ const props = withDefaults(
versiontitle?: string; versiontitle?: string;
viewPage?: viewPageType; viewPage?: viewPageType;
formBasicConfig?: any; formBasicConfig?: any;
fieldsDetailList?:any;
}>(), }>(),
{ {
showPage: true, showPage: true,
@ -108,6 +109,9 @@ const props = withDefaults(
formBasicConfig: () => { formBasicConfig: () => {
return {}; return {};
}, },
fieldsDetailList: () => {
return {};
},
} }
); );
const emits = defineEmits<{ const emits = defineEmits<{
@ -247,16 +251,20 @@ function modifyFieldsMap4(fieldsMap: any): Array<{ key: string, value: string }>
return result; return result;
} }
//
const isButton1Disabled = ref(false);
const isButton2Disabled = ref(false);
async function downloadTables() { async function downloadTables() {
isButton1Disabled.value = true;
isButton2Disabled.value = true;
const loadingInstance = ElLoading.service({ const loadingInstance = ElLoading.service({
fullscreen: true, fullscreen: true,
text: '正在生成图片,请稍候...' // text: '正在生成图片,请稍候...' //
}); });
//ElMessage('This is a message.') //ElMessage('This is a message.')
const zip = new JSZip(); const zip = new JSZip();
console.log(tableRefs) //console.log(tableRefs)
for (const [tableKey, element] of Object.entries(tableRefs)) { for (const [tableKey, element] of Object.entries(tableRefs)) {
try { try {
const canvas = await html2canvas(element); const canvas = await html2canvas(element);
@ -288,13 +296,157 @@ async function downloadTables() {
loadingInstance.close() loadingInstance.close()
link.click(); link.click();
tableRefs = {} tableRefs = {}
//
isButton1Disabled.value = false;
isButton2Disabled.value = false;
}); });
} }
function closeQrDownload(){ function closeQrDownload(){
qrCodesPrintDialogFlag.value = false qrCodesPrintDialogFlag.value = false
tableRefs = {} tableRefs = {}
console.log(tableRefs) //console.log(tableRefs)
}
let asfs: any[] = [];
let radios: any[] = [];
let checkboxs: any[] = [];
let switchs: any[] = [];
let selects: any[] = [];
let tables: any[] = [];
function getAsfs() {
//setTimeout(() => {
let dataList = ref({});
dataList.value = props.fieldsDetailList
if (dataList && Array.isArray(dataList.value) && dataList.value.length > 0) {
for (let i = 0; i < dataList.value.length; i++) {
if (dataList.value[i].type == "associatedForms") {
asfs.push(dataList.value[i]);
}else if(dataList.value[i].type == "radio"){
radios.push(dataList.value[i])
} else if(dataList.value[i].type == "checkbox"){
checkboxs.push(dataList.value[i])
} else if(dataList.value[i].type == "switch"){
switchs.push(dataList.value[i])
} else if(dataList.value[i].type == "select"){
selects.push(dataList.value[i])
} else if (
dataList.value[i].type == "card" ||
dataList.value[i].type == "flex" ||
dataList.value[i].type == "div" ||
dataList.value[i].type == "table"
) {
if (dataList.value[i].type == "table") {
tables.push(dataList.value[i]);
}
dataList.value[i].list.forEach((element: any) => {
if (element.type == "associatedForms") {
asfs.push(element);
}else if(element.type == "radio"){
radios.push(element)
}else if(element.type == "checkbox"){
checkboxs.push(element)
}else if(element.type == "switch"){
switchs.push(element)
}else if(element.type == "select"){
selects.push(element)
}
});
} else if (dataList.value[i].type == "grid") {
let columns = JSON.parse(JSON.stringify(dataList.value[i].columns));
if (columns.length > 0) {
for (let z = 0; z < columns.length; z++) {
for (let x = 0; x < columns[z].list.length; x++) {
let a = JSON.parse(JSON.stringify(columns[z].list[x]));
if (a.type == "associatedForms") {
asfs.push(a);
}else if(a.type == "radio"){
radios.push(a)
}else if(a.type == "checkbox"){
checkboxs.push(a)
}else if(a.type == "switch"){
switchs.push(a)
}else if(a.type == "select"){
selects.push(a)
}
}
}
}
} else if (dataList.value[i].type == "tabs") {
//tabsflextable
let columns = JSON.parse(JSON.stringify(dataList.value[i].columns));
if (columns.length > 0) {
for (let z = 0; z < columns.length; z++) {
for (let x = 0; x < columns[z].list.length; x++) {
let a = JSON.parse(JSON.stringify(columns[z].list[x]));
if (a.type == "associatedForms") {
asfs.push(a);
}else if(a.type == "radio"){
radios.push(a)
}else if(a.type == "checkbox"){
checkboxs.push(a)
}else if(a.type == "switch"){
switchs.push(a)
}else if(a.type == "select"){
selects.push(a)
}else if (a.type == "flex" || a.type == "table") {
if (a.type == "table") {
tables.push(dataList.value[i]);
} }
if (a.list.length > 0) {
for (let m = 0; m < a.list.length; m++) {
let q = JSON.parse(JSON.stringify(a.list[m]));
if (q.type == "associatedForms") {
asfs.push(q);
}else if(q.type == "radio"){
radios.push(q)
}else if(q.type == "checkbox"){
checkboxs.push(q)
}else if(q.type == "switch"){
switchs.push(q)
}else if(q.type == "select"){
selects.push(q)
}
}
}
}
}
}
}
}
}
}
//}, 500);
}
function convertStringToArray(str: string) {
if (typeof str!== 'string') {
throw new Error('Input must be a string.');
}
if (str === '') {
return [];
}
//
str = str.slice(1, -1);
if (str === '') {
return [];
}
let parts = str.split(',');
return parts.map(part => parseFloat(part));
}
//liwenxuan 20250120 end
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2024-04-01 11:36:07 @ 时间: 2024-04-01 11:36:07
@ -308,37 +460,184 @@ const setUpClick = (val: string, id: string) => {
} else if(val.key == "showQrCode"){ } else if(val.key == "showQrCode"){
//liwenxuan 20250114 start //liwenxuan 20250114 start
//, //,
let idArray = state.selectionChecked.map(item => item.id); let idArray = state.selectionChecked.map(item => item.id);
if(idArray.length>0){ if(idArray.length>0){
const loadingInstance1 = ElLoading.service({
fullscreen: true,
text: '正在生成二维码,请稍候...' //
});
//console.log(props.formBasicConfig) //console.log(props.formBasicConfig)
// //
let getDetailQrCodesData: any = {}
let currentFieldsMapArrObj: any = {}
getDetailQrCodes(idArray).then(({ data }) => { getDetailQrCodes(idArray).then(({ data }) => {
getDetailQrCodesData = JSON.parse(JSON.stringify(data));
if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"){
let asfQueryParams1: any[] = [];
for (let key in getDetailQrCodesData) {
currentFieldsMapArrObj[key] = getDetailQrCodesData[key]
if (getDetailQrCodesData.hasOwnProperty(key)) {
let currentFieldsMap = getDetailQrCodesData[key].fieldsMap
//console.log(currentFieldsMap)
//
for (let attr_name in currentFieldsMap) {
if (currentFieldsMap.hasOwnProperty(attr_name)) {
//console.log("attr_name------"+attr_name)
//console.log(`: ${attr_name}, : ${currentFieldsMap[attr_name]}`);
radios.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
let optionsHasCurrentValue = false
element.options.forEach((element1: any) => {
if(toConvertValue==element1.value){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label
optionsHasCurrentValue = true
}
});
if(optionsHasCurrentValue==false){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+""
}
}
});
selects.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
let optionsHasCurrentValue = false
element.options.forEach((element1: any) => {
if(toConvertValue==element1.value){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+element1.label
optionsHasCurrentValue = true
}
});
if(optionsHasCurrentValue==false){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+""
}
}
});
switchs.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
if(toConvertValue=="0"){
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"禁用"
}else{
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+"启用"
}
}
});
checkboxs.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
let toConvertArr = convertStringToArray(toConvertValue);
let toAddStr = ""
if(toConvertArr.length>0){
toConvertArr.forEach((element1: any) => {
element.options.forEach((element2: any) => {
if(element1==element2.value){
toAddStr = toAddStr+element2.label+","
}
});
});
toAddStr = toAddStr.slice(0, -1)
currentFieldsMap[attr_name] = currentFieldsMap[attr_name].split("!@#@!")[0]+"!@#@!"+toAddStr
}
}
});
asfs.forEach(function(element) {
if(attr_name==element.name){
//,valueoptions
let toConvertValue = currentFieldsMap[attr_name].split("!@#@!")[1]
if(toConvertValue.length>0){
//console.log(element)
let fieldCount = 0;//>0field
asfQueryParams1.forEach((item1: any) => {
//field asfQueryParamsItem1,fieldasfQueryParamsItem1.asfToSelectIds1asfMasterAndAsfId1
// pushasfQueryParamsItem1
if(item1.field==element.name){
fieldCount++
}
});
if(fieldCount>0){
//
//field
asfQueryParams1.forEach((item1: any) => {
if(item1.field==element.name){
let asfMasterAndAsfId1: any = {};
asfMasterAndAsfId1.asfId = toConvertValue+"";
asfMasterAndAsfId1.asfMasterId = key+"";
item1.asfToSelectIds.push(asfMasterAndAsfId1)
}
});
}else{
//
let asfQueryParamsItem1: any = {};
asfQueryParamsItem1.formId = element.control.formid;
asfQueryParamsItem1.field = element.name;
let asfToSelectIds1: any[] = [];
asfQueryParamsItem1.asfToSelectIds = asfToSelectIds1;
let asfMasterAndAsfId1: any = {};
asfMasterAndAsfId1.asfId = toConvertValue+"";
asfMasterAndAsfId1.asfMasterId = key+"";
asfToSelectIds1.push(asfMasterAndAsfId1)
asfQueryParams1.push(asfQueryParamsItem1)
}
}
}
})
}
}
setTimeout(()=>{
getDetailQrCodesData[key].fieldsMap = modifyFieldsMap4(currentFieldsMap)
},800)
}
}
getAsfDataTitlesByIds(asfQueryParams1).then(({ data }) => {
let getAsfDataTitlesByIdsData = JSON.parse(JSON.stringify(data));
for (let key in currentFieldsMapArrObj) {
if (getDetailQrCodesData.hasOwnProperty(key)) {
let currentFieldsMap = getDetailQrCodesData[key].fieldsMap
getAsfDataTitlesByIdsData.forEach((element1: any) => {
element1.list.forEach((element2: any) => {
if(key==element2.asfMasterId){
currentFieldsMap[element1.field] = currentFieldsMap[element1.field].split("!@#@!")[0]+"!@#@!"+element2.label
}
})
})
}
}
})
if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="2"){
for (let key in data) { setTimeout(()=>{
if (data.hasOwnProperty(key)) { tablesData.value = getDetailQrCodesData
let currentFieldsMap = data[key].fieldsMap },810)
data[key].fieldsMap = modifyFieldsMap4(currentFieldsMap)
//data[key].bufferedImage = ""
}
} setTimeout(()=>{
tablesData.value = data loadingInstance1.close()
//console.log(qrCodesPrintDialogData.value)
qrCodesPrintDialogFlag.value = true qrCodesPrintDialogFlag.value = true
},820)
}else if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="1"){ }else if(props.formBasicConfig.qrCodePrintStyle&&props.formBasicConfig.qrCodePrintStyle=="1"){
//fieldsMap = null //fieldsMap = null
tablesData.value = getDetailQrCodesData
qrCodesPrintDialogFlag.value = true qrCodesPrintDialogFlag.value = true
loadingInstance1.close()
} }
}) })/* .finally(()=>{
loadingInstance1.close()
qrCodesPrintDialogFlag.value = true
}) */
}else{ }else{
alert("未选中任何一条,请先选择") alert("未选中任何一条,请先选择")
} }
//liwenxuan 20250114 end //liwenxuan 20250114 end
@ -565,6 +864,13 @@ const getPageData = () => {
}) })
.finally(() => { .finally(() => {
state.loading = false; state.loading = false;
asfs = [];
radios = [];
checkboxs = [];
switchs = [];
selects = [];
tables = [];
getAsfs()
}); });
} }
}; };
@ -620,7 +926,8 @@ const asfGetPageData = (asfFormId: any, asfToSelectMastersKey: any) => {
let asfToSelectIds = []; let asfToSelectIds = [];
for (let i = 0; i < data.data.list.length; i++) { for (let i = 0; i < data.data.list.length; i++) {
let asfMasterAndAsfId: any = {}; let asfMasterAndAsfId: any = {};
asfMasterAndAsfId.asfId = data.data.list[i][asfDetails[j].field]; //asfMasterAndAsfId.asfId = data.data.list[i][asfDetails[j].field];
asfMasterAndAsfId.asfId = data.data.list[i].id
asfMasterAndAsfId.asfMasterId = data.data.list[i].id; asfMasterAndAsfId.asfMasterId = data.data.list[i].id;
asfToSelectIds.push(asfMasterAndAsfId); asfToSelectIds.push(asfMasterAndAsfId);
@ -668,11 +975,15 @@ const asfGetPageData = (asfFormId: any, asfToSelectMastersKey: any) => {
}) })
.finally(() => { .finally(() => {
/* state.loading = false; */ /* state.loading = false; */
setTimeout(()=>{
//nextTick(() => {
// //
tablePageClass.value = 4; tablePageClass.value = 4;
drawerWith.value = container.value?.clientWidth; drawerWith.value = container.value?.clientWidth;
asflookPageInfoIsShow.value = true; asflookPageInfoIsShow.value = true;
//});
},500)
}); });
}; };
@ -681,6 +992,7 @@ onMounted(() => {
nextTick(() => { nextTick(() => {
drawerWith.value = container.value?.clientWidth; drawerWith.value = container.value?.clientWidth;
}); });
getAsfs()
}); });
//liwenxuan start //liwenxuan start
function getAsfDataTitlesByIds(asfQueryParams: any[]) { function getAsfDataTitlesByIds(asfQueryParams: any[]) {
@ -1652,7 +1964,7 @@ const diGuiJilian = (val: any, options: any[]) => {
> >
<table> <table>
<tr> <tr>
<th style="font-weight: bold; font-size:medium;" colspan="2">{{ tableData.groupName }}-{{ tablesData[tableKey].appName }}-{{ tablesData[tableKey].formName }}-{{ tableKey }}</th> <th style="font-weight: bold; font-size:medium;" colspan="2">{{ tablesData[tableKey].appName }}-{{ tablesData[tableKey].formName }}</th>
<th rowspan="6"><img :src="tableData.bufferedImage" alt="二维码" width="auto" height="100%"></th> <th rowspan="6"><img :src="tableData.bufferedImage" alt="二维码" width="auto" height="100%"></th>
</tr> </tr>
<tr v-for="(item, fIndex) in tableData.fieldsMap" :key="fIndex"> <tr v-for="(item, fIndex) in tableData.fieldsMap" :key="fIndex">
@ -1662,10 +1974,29 @@ const diGuiJilian = (val: any, options: any[]) => {
</table> </table>
</div> </div>
</div> </div>
<div v-if="formBasicConfig.qrCodePrintStyle == '1'" style="display: flex; flex-direction: column; align-items: center; min-height: 50px; max-height: 750px; overflow-y: auto">
<div
v-for="(tableData, tableKey) in tablesData"
:id="tableKey"
:key="tableKey"
:ref="(el: any) => { if (el) tableRefs[tableKey] = el }"
style="margin-bottom: 30px; width: 400px;"
>
<table >
<tr>
<th style="font-weight: bold; font-size:medium;" colspan="1">{{ tablesData[tableKey].appName }}-{{ tablesData[tableKey].formName }}-{{ tablesData[tableKey].dataTitle }}</th>
</tr>
<tr>
<th ><img :src="tableData.bufferedImage" alt="二维码" width="auto" height="100%"></th>
</tr>
</table>
</div>
</div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<!-- <el-button type="primary" plain @click="downloadTables">下载</el-button> --> <el-button :disabled="isButton1Disabled" type="primary" plain @click="downloadTables">下载</el-button>
<el-button type="primary" plain @click="closeQrDownload"> <el-button :disabled="isButton2Disabled" type="primary" plain @click="closeQrDownload">
确定 确定
</el-button> </el-button>
</div> </div>

1
src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue

@ -484,6 +484,7 @@ defineExpose({
v-model:look-page-is-show="lookPageIsShow" v-model:look-page-is-show="lookPageIsShow"
:viewPage="stateList.view" :viewPage="stateList.view"
:form-basic-config="stateForm.formData.form" :form-basic-config="stateForm.formData.form"
:fields-detail-list="stateForm.formData.list"
@optionsValue5Get5="optionsValue5Get5" @optionsValue5Get5="optionsValue5Get5"
/> />
<ak-form <ak-form

2
src/views/sysworkflow/lowcodepage/runApp/runAppForm.vue

@ -355,6 +355,8 @@ function optionsValue3Get3(data: any, fieldName: string) {
:sign-code="appInitData.signCode" :sign-code="appInitData.signCode"
:pickAppMenu="props.pickAppMenu" :pickAppMenu="props.pickAppMenu"
:viewPage="stateList.view" :viewPage="stateList.view"
:form-basic-config="stateForm.formData.form"
:fields-detail-list="stateForm.formData.list"
/> />
<!-- <AppFormPage <!-- <AppFormPage
v-else v-else

Loading…
Cancel
Save