| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452 |
- ##通用参数
- #parse("PublicMacro/ConstantMarco.vm")
- #ConstantParams()
- #parse("PublicMacro/FormMarco.vm")
- ## dataform属性生成
- #macro(EditDataform)
- #foreach($fieLdsModel in ${context.fields})
- #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
- #set($fieLdsModel =$fieLdsModel.formColumnModel.fieLdsModel)
- #set($vModel = "${html.vModel}")
- #if($vModel !='')
- #set($config = $html.config)
- #set($jk = $html.config.jnpfKey)
- #set($dataType = "$!{config.dataType}")
- #set($defaultCurrent = $config.defaultCurrent)
- #set($defult = $config.defaultValue)
- #set($format = $html.format)
- #if($jk!='text' && $jk!='divider')
- #GetFeildDefaultValue("")
- #end
- #end
- #end
- #foreach($mast in ${context.mastTable})
- #set($mastField = $mast.formMastTableModel.mastTable.fieLdsModel)
- #set($fieLdsModel =$mast.formMastTableModel.mastTable.fieLdsModel)
- #set($config =$mastField.config)
- #set($jk = ${config.jnpfKey})
- #set($vModel = ${mast.formMastTableModel.vModel})
- #set($dataType = "$!{config.dataType}")
- #set($defaultCurrent = $config.defaultCurrent)
- #set($defult = $config.defaultValue)
- #set($format = $mastField.format)
- #if($jk!='text' && $jk!='divider')
- #GetFeildDefaultValue("")
- #end
- #end
- #if($context.version)
- version: 0,
- #end
- #end
- <script lang="ts" setup>
- #if($context.isFlow)
- import { getList, del, exportData, batchDelete} from './helper/api';
- import { create, update,getCandidates } from '#/api/workFlow/task';
- import { useFlowState } from '#/hooks/flow/useFlowStatus';
- import FlowParser from '#/views/workFlow/components/FlowParser.vue';
- import CandidateModal from '#/views/workFlow/components/modal/CandidateModal.vue';
- import { getFlowStartFormId } from '#/api/workFlow/template';
- import { useTabs } from '@vben/hooks';
- #else
- import { getList, del, exportData, batchDelete, create, update } from './helper/api';
- #end
- import { getConfigData,getViewList } from '#/api/onlineDev/visualDev';
- // 工作流
- import { getDictionaryDataSelector } from '#/api/systemData/dictionary';
- import { getDataInterfaceRes } from '#/api/systemData/dataInterface';
- import { ref, reactive, onMounted, toRefs, computed, unref, nextTick, toRaw } from 'vue';
- import { useMessage } from '@jnpf/hooks';
- import { $t } from '#/locales';
- import { useOrganizeStore ,useBaseStore} from '#/store';
- import { useAccessStore,useUserStore } from '@vben/stores';
- import { BasicModal, useModal } from '@jnpf/ui/modal';
- import { usePopup } from '@jnpf/ui/popup';
- import { ScrollContainer } from '@jnpf/ui';
- import { BasicForm, useForm } from '@jnpf/ui/form';
- import { BasicVxeTable, useVxeTable, TableAction, type ActionItem, type TableActionType, type SorterResult } from '@jnpf/ui/vxeTable';
- import { JnpfRelationForm } from '@jnpf/ui';
- #if(${context.superQuery})
- import { SuperQueryModal } from '#/components/CommonModal';
- #end
- #foreach($itemBtn in ${context.columnBtnPcList})
- #if(!${context.isFlow} &&${itemBtn.value}=="detail")
- import Detail from './Detail.vue';
- #end
- #if(${itemBtn.value}=="edit")
- #end
- #if(${itemBtn.value}=="remove")
- #end
- #end
- ## 是否有批量删除和批量打印按钮
- #set($hasCheckBox = false)
- #foreach($itemBtn in ${context.btnPcList})
- #if(${itemBtn.value}=="add")
- #end
- #if(${itemBtn.value}=="upload")
- import { ImportModal} from '#/components/CommonModal';
- #end
- #if(${itemBtn.value}=="download")
- import { ExportModal } from '#/components/CommonModal';
- import { downloadByUrl } from '@jnpf/utils';
- #end
- #if(${itemBtn.value}=="batchRemove")
- #if(${itemBtn.show})
- #set($hasCheckBox = true)
- #end
- #end
- #if(${itemBtn.value}=="batchPrint")
- #if(${itemBtn.show})
- #set($hasCheckBox = true)
- #end
- // 打印模板多条生成PrintSelect
- import PrintSelect from '#/components/PrintDesign/printSelect/index.vue';
- import PrintBrowse from '#/components/PrintDesign/printBrowse/index.vue';
- #end
- #end
- // 有关联表单详情:开始
- import RelationDetail from '#/views/common/dynamicModel/list/detail/index.vue';
- // 有关联表单详情:结束
- #if(!$context.isFlow)
- import ExtraForm from './ExtraForm.vue';
- #end
- import { useRoute,useRouter } from 'vue-router';
- import { FilterOutlined } from '@ant-design/icons-vue';
- import { getSearchFormSchemas } from '#/components/FormGenerator/src/helper/transform';
- import { cloneDeep ,omit} from 'lodash-es';
- import columnList from './helper/columnList';
- import searchList from './helper/searchList';
- import superQueryJson from './helper/superQueryJson';
- import { dyOptionsList, systemComponentsList } from '#/components/FormGenerator/src/helper/config';
- import dayjs from 'dayjs';
- import { thousandsFormat , getDateTimeUnit, getTimeUnit} from '@jnpf/utils';
- import { getParamList } from '#/utils/jnpf';
- import { usePermission } from '@jnpf/hooks';
- import ViewSetting from '#/views/common/dynamicModel/list/components/ViewSetting.vue';
- import ViewList from '#/views/common/dynamicModel/list/components/ViewList.vue';
- interface State {
- flowId: string;
- config: any;
- columnList: any[];
- printListOptions: any[];
- columnBtnsList: any[];
- customBtnsList: any[];
- treeFieldNames: any;
- leftTreeData: any[];
- leftTreeLoading: boolean;
- treeActiveId: string;
- treeActiveNodePath: any;
- columns: any[];
- allColumns: any[];
- complexColumns: any[];
- childColumnList: any[];
- exportList: any[];
- cacheList: any[];
- currFlow: any;
- isCustomCopy: boolean;
- candidateType: number;
- currRow: any;
- workFlowFormData: any;
- expandObj: any;
- columnSettingList: any[];
- searchSchemas: any[];
- treeRelationObj: any;
- keyword: string;
- #if(${context.tabConfig.createTab})
- tabActiveKey: any;
- tabList: any[];
- tabQueryJson: any;
- #end
- viewList: any[];
- currentView: any;
- }
- const route = useRoute();
- const { hasBtnP } = usePermission();
- const { createMessage, createConfirm } = useMessage();
- const organizeStore = useOrganizeStore();
- const userStore = useUserStore();
- const accessStore = useAccessStore();
- const { permissionList } = accessStore;
- const userInfo = userStore.getUserInfo;
- const baseStore = useBaseStore();
- const [registerExportModal, { openModal: openExportModal, closeModal: closeExportModal, setModalProps: setExportModalProps }] = useModal();
- const [registerImportModal, { openModal: openImportModal }] = useModal();
- const [registerSuperQueryModal, { openModal: openSuperQuery }] = useModal();
- #if(${context.hasPrintBtn})
- const [registerPrintSelect, { openModal: openPrintSelect }] = useModal();
- const [registerPrintBrowse, { openModal: openPrintBrowse }] = useModal();
- #end
- #if(${context.isFlow})
- // 工作流
- const { closeCurrentTab } = useTabs();
- const router = useRouter();
- const [registerFlowParser, { openPopup: openFlowParser }] = usePopup();
- const [registerCandidate, { openModal: openCandidateModal, closeModal: closeCandidateModal }] = useModal();
- const { getFlowStatusContent, getFlowStatusColor } = useFlowState();
- #end
- // 工作流
- const formRef = ref<any>(null);
- const tableRef = ref<Nullable<TableActionType>>(null);
- const detailRef = ref<any>(null);
- #if(!$context.isFlow)
- const extraFormRef = ref<any>(null);
- #end
- const relationDetailRef = ref<any>(null);
- const state = reactive<State>({
- flowId: '',//请在此处填写流程模板id
- config: {},
- columnList: [],
- printListOptions: [],
- columnBtnsList: [],
- customBtnsList: [],
- treeFieldNames: {
- children: #if(${context.columnData.treePropsChildren}) '${context.columnData.treePropsChildren}' #else 'children' #end,
- title: #if(${context.columnData.treePropsLabel}) '${context.columnData.treePropsLabel}' #else 'fullName' #end,
- key: #if(${context.columnData.treeDataSource}=='organize'||${context.columnData.treeDataSource}=='formField')'organizeIds' #elseif(${context.columnData.treePropsValue}) '${context.columnData.treePropsValue}' #else 'id' #end,
- isLeaf: 'isLeaf',
- },
- leftTreeData: [],
- leftTreeLoading: false,
- treeActiveId: '',
- treeActiveNodePath: [],
- columns: [],
- allColumns: [],
- complexColumns: [], // 复杂表头
- childColumnList: [],
- exportList: [],
- cacheList: [],
- currFlow: {},
- isCustomCopy: false,
- candidateType: 1,
- currRow: {},
- workFlowFormData: {},
- expandObj: {},
- columnSettingList: [],
- searchSchemas: [],
- treeRelationObj: null,
- keyword: '',
- #if(${context.tabConfig.createTab})
- tabActiveKey: '',
- tabList: [],
- tabQueryJson: {},
- #end
- viewList: [],
- currentView: {},
- });
- const defaultSearchInfo = {
- menuId: route.meta.modelId as string,
- moduleId:'${context.moduleId}',
- superQueryJson: '',
- #if(${context.hasPage} && !${context.groupTable} && !${context.treeTable})
- dataType:0,
- #end
- #if(${context.isFlow})
- flowId:state.flowId,
- #end
- };
- const searchInfo = reactive({
- ...cloneDeep(defaultSearchInfo),
- });
- const { flowId, childColumnList, searchSchemas, viewList, currentView, allColumns } = toRefs(state);
- const [registerSearchForm, { updateSchema, resetFields, submit: searchFormSubmit }] = useForm({
- baseColProps: { span: 6 },
- showActionButtonGroup: true,
- showAdvancedButton: true,
- compact: true,
- });
- const [registerTable, { reload, setLoading, getFetchParams, getSelectRows, getSelectRowKeys, redoHeight, insertTableDataRecord, updateTableDataRecord, deleteTableDataRecord,clearSelectedRowKeys }] = useVxeTable({
- api: getList,
- immediate: false,
- tableSetting: { setting: false },
- afterFetch: (data) => {
- const list = data.map((o) => ({ ...o, rowEdit: false }));
- state.cacheList = cloneDeep(list);
- return list;
- },
- });
- ##按钮权限,控制方法(用于生成复选框)
- const getHasBatchBtn = computed(() => {
- let btnsList: any[] =[]
- #if(${context.webType}!=4)
- #if(${context.hasRemoveBtn})
- btnsList.push('batchRemove')
- #end
- #if(${context.hasPrintBtn})
- btnsList.push('batchPrint')
- #end
- #if(${context.hasDownloadBtn})
- btnsList.push('download')
- #end
- ### 有权限判断的时候生成这句代码
- #if(${context.columnData.useBtnPermission})
- btnsList=btnsList.filter(o => hasBtnP('btn_' + o))
- #end
- #end
- return !!btnsList.length
- });
- const getColumns = computed(() => {
- const columns = state.columns;
- return setListValue(state.currentView?.columnList, columns, 'prop');
- });
- const getSearchList = computed(() => {
- const searchSchemas = cloneDeep(state.searchSchemas).map(o => ({ ...o, show: true }));
- const schemas = setListValue(state.currentView?.searchList, searchSchemas, 'field');
- buildSearchOptions(schemas);
- return schemas;
- });
- const getTableBindValue = computed(() => {
- let columns = unref(getColumns).map((o) => ({ ...omit(o, ['type', 'format']) }));
- #if(${context.isFlow})
- columns.push({ title: $t('component.table.status'), dataIndex: 'flowState', width: 100, align: 'center', fixed: columns.some(o => o.fixed == 'right') ? 'right' : false, slots: { default: 'flowState' }, });
- #end
- const defaultSortConfig=#if(${context.columnData.defaultSortConfig})${context.columnData.defaultSortConfig}#else []#end;
- const sortField = defaultSortConfig.map(o => (o.sort === 'desc' ? '-' : '') + o.field);
- const data: any = {
- #if(!${context.hasPage} || ${context.groupTable} || ${context.treeTable})
- pagination: false, //没有分页,树形,分组
- #else
- pagination: { pageSize: ${context.columnData.pageSize} }, //有分页
- #end
- searchInfo: unref(searchInfo),
- defSort: { sidx: sortField.join(',') },
- sortConfig: { multiple: true },
- sortFn: (sortInfo: SorterResult | SorterResult[]) => {
- if (Array.isArray(sortInfo)) {
- const sortList = sortInfo.map((o) => (o.order === 'desc' ? '-' : '') + o.field);
- return { sidx: sortList.join(',') };
- } else {
- const { field, order } = sortInfo;
- return field && order ? { sidx: (order === 'desc' ? '-' : '') + field } : {};
- }
- },
- columns,
- clearSelectOnPageChange: true,
- showOverflow: false,
- #if(${context.configurationTotal})
- showFooter:true,
- footerMethod:footerMethod,
- #end
- #if(!${context.isFlow})
- indexColumnProps: { slots: { default: 'editIndex' } },
- #end
- actionColumn: {
- width: 150,
- title: $t('component.table.action'),
- dataIndex: 'action',
- },
- #if($!{context.complexHeaderList.size()}>0) border: true, #end
- };
- if (unref(getHasBatchBtn)) data.rowSelection = { type: 'checkbox' };
- return data;
- });
- ##合计变量
- #if(${context.configurationTotal})
- const getSummaryColumn = computed(() => {
- let defaultColumns = unref(getColumns);
- // 处理列固定
- if (state.columnSettingList?.length) {
- for (let i = 0; i < defaultColumns.length; i++) {
- inner: for (let j = 0; j < state.columnSettingList.length; j++) {
- if (defaultColumns[i].dataIndex === state.columnSettingList[j].dataIndex) {
- defaultColumns[i].fixed = state.columnSettingList[j].fixed;
- defaultColumns[i].visible = state.columnSettingList[j].visible;
- break inner;
- }
- }
- }
- defaultColumns = defaultColumns.filter((o) => o.visible);
- }
- let columns: any[] = [];
- for (let i = 0; i < defaultColumns.length; i++) {
- const e = defaultColumns[i];
- if (e.jnpfKey === 'table' || e.jnpfKey === 'complexHeader') {
- if (e.children?.length) columns.push(...e.children);
- } else {
- columns.push(e);
- }
- if (e.fixed && e.children?.length) {
- for (let j = 0; j < e.children.length; j++) {
- e.children[j].fixed = e.fixed;
- }
- }
- }
- const leftFixedList = columns.filter((o) => o.fixed === 'left');
- const rightFixedList = columns.filter((o) => o.fixed === 'right');
- const noFixedList = columns.filter((o) => o.fixed !== 'left' && o.fixed !== 'right');
- return [...leftFixedList, ...noFixedList, ...rightFixedList];
- });
- const getColumnSum = computed(() => {
- const sums: any[] = [];
- const summaryField: any = #if(${context.fieldsTotal})${context.fieldsTotal}#else [] #end; //取summaryField
- const isSummary = (key) => summaryField.includes(key);
- const useThousands = key => unref(getSummaryColumn).some(o => o.__vModel__ === key && o.thousands);
- unref(getSummaryColumn).forEach((column, index) => {
- let sumVal = state.cacheList.reduce((sum, d) => sum + getCmpValOfRow(d, column.prop), 0);
- if (!isSummary(column.prop)) sumVal = '';
- sumVal = Number.isNaN(sumVal) ? '' : sumVal;
- const realVal = sumVal && !Number.isInteger(sumVal) ? Number(sumVal).toFixed(2) : sumVal;
- sums[index] = useThousands(column.prop) ? thousandsFormat(realVal) : realVal;
- });
- // // 有多选
- // sums.unshift('');
- // // 有多选
- return sums;
- });
- #end
- ##合计方法
- #if(${context.configurationTotal})
- // 列表合计
- function footerMethod({ columns, data }) {
- const summaryField: any =#if(${context.fieldsTotal})${context.fieldsTotal}#else [] #end; //取summaryField
- const isSummary = (key) => summaryField.includes(key);
- const useThousands = (key) => unref(getSummaryColumn).some((o) => o.__vModel__ === key && o.thousands);
- return [
- columns.map((column, columnIndex) => {
- if (columnIndex === 0) return '合计';
- if (!data.length) return '';
- let sumVal = data.reduce((sum, d) => sum + getCmpValOfRow(d, column.property), 0);
- if (!isSummary(column.property)) sumVal = '';
- sumVal = Number.isNaN(sumVal) ? '' : sumVal;
- const realVal = sumVal && !Number.isInteger(sumVal) ? Number(sumVal).toFixed(2) : sumVal;
- sumVal = useThousands(column.property) ? thousandsFormat(realVal) : realVal;
- return sumVal;
- }),
- ];
- }
- //合计方法
- function getCmpValOfRow(row, key) {
- const summaryField: any = #if(${context.fieldsTotal})${context.fieldsTotal}#else [] #end; //取summaryField
- const isSummary = (key) => summaryField.includes(key);
- if (!summaryField.length || !isSummary(key)) return 0;
- const target = row[key];
- if (!target) return 0;
- const data = Number.isNaN(target) ? 0 : Number(target);
- return data;
- }
- #end
- ##行内按键
- function getTableActions(record,index): ActionItem[] {
- const list: any[] = [
- #foreach($itemBtn in ${context.columnBtnPcList})
- #if(${itemBtn.value}=="edit" && ${itemBtn.show})
- {
- label: #if(${itemBtn.labelI18nCode}) $t('${itemBtn.labelI18nCode}','${itemBtn.label}') #else '${itemBtn.label}' #end,
- #if(${context.isFlow})
- disabled: ![0,8,9].includes(record.flowState), //有流程加上
- #end
- onClick: updateHandle.bind(null, record),
- #if(${context.columnData.useBtnPermission})
- auth: 'btn_edit', //有按钮权限
- #end
- },
- #end
- #if(${itemBtn.value}=="detail" && ${itemBtn.show})
- {
- label: #if(${itemBtn.labelI18nCode}) $t('${itemBtn.labelI18nCode}','${itemBtn.label}') #else '${itemBtn.label}' #end,
- #if(${context.isFlow})
- disabled: !record.flowState, //有流程加上
- #end
- onClick: goDetail.bind(null, record),
- #if(${context.columnData.useBtnPermission})
- auth: 'btn_detail', //有按钮权限
- #end
- },
- #end
- #if(${itemBtn.value}=="remove" && ${itemBtn.show})
- {
- label: #if(${itemBtn.labelI18nCode}) $t('${itemBtn.labelI18nCode}','${itemBtn.label}') #else '${itemBtn.label}' #end,
- color: 'error',
- #if(${context.isFlow})
- disabled: ![0,9].includes(record.flowState), //有流程加上
- #end
- modelConfirm: {
- onOk: handleDelete.bind(null, record.id),
- },
- #if(${context.columnData.useBtnPermission})
- auth: 'btn_remove', //有按钮权限
- #end
- },
- #end
- #end
- ];
- if (record.rowEdit) {
- let editBtnList: ActionItem[] = [
- { label: $t('common.saveText'), onClick: saveForRowEdit.bind(null, record, 0) },
- { label: $t('common.cancelText'), color: 'error', onClick: cancelRowEdit.bind(null, record, index) },
- ];
- #if($context.isFlow)
- // 有工作流
- editBtnList.push({ label: $t('common.submitText'), onClick: submitForRowEdit.bind(null, record) });
- #end
- return editBtnList;
- }
- return list;
- }
- ##开启流程--流程调用相关方法
- #if(${context.isFlow})
- // 选择候选人
- function submitCandidate(data) {
- saveForRowEdit(state.currRow, 1, data);
- }
- #end
- function cancelRowEdit(record, index) {
- const id = !record.id || record.id === 'jnpfAdd' ? '' : record.id;
- if (!id) return deleteTableDataRecord('jnpfAdd');
- record.rowEdit = false;
- const item = cloneDeep(state.cacheList[index]);
- updateTableDataRecord(item.id, item);
- }
- // 行内编辑保存
- function saveForRowEdit(record, status = 0, candidateData: any = null) {
- #if(${context.isFlow})
- const id = record.flowTaskId ? record.flowTaskId : !record.id || record.id === 'jnpfAdd' ? '' : record.id;
- // 工作流
- let query = {
- id,
- status: status || 0,
- candidateType: state.candidateType,
- formData: record,
- flowId: state.flowId,
- flowUrgent: 1,
- };
- if (candidateData) query = { ...query, ...candidateData };
- const formMethod = id ? update : create;
- formMethod(query).then(res => {
- createMessage.success(res.msg);
- closeCandidateModal();
- reload({ page: 1 });
- });
- #else
- const id = !record.id || record.id === 'jnpfAdd' ? '' : record.id;
- const query = { ...record ,id};
- const formMethod = id ? update : create;
- formMethod(query).then((res) => {
- createMessage.success(res.msg);
- reload({ page: 1 });
- });
- #end
- }
- // 行内编辑提交审核
- function submitForRowEdit(record) {
- const id = !record.id || record.id === 'jnpfAdd' ? '' : record.id;
- state.currRow = record;
- state.workFlowFormData = {
- id,
- formData: record,
- flowId: state.flowId,
- };
- getCandidates(0, state.workFlowFormData).then((res) => {
- const candidateList = res?.data?.list.filter(o => !o.isBranchFlow && o.isCandidates);
- const branchList = res.data.list.filter(o => o.isBranchFlow);
- if (!candidateList.length && res.data.type == 3) {
- createConfirm({
- iconType: 'warning',
- title: '提示',
- content: '您确定要提交当前流程吗, 是否继续?',
- onOk: () => {
- saveForRowEdit(record, 1);
- },
- });
- return;
- }
- openCandidateModal(true, {branchList, candidateList, taskId: state.config.taskId, formData: state.workFlowFormData });
- });
- }
- ##行内按键方法
- #foreach($itemBtn in ${context.columnBtnPcList})
- #if(${itemBtn.value}=="edit" && ${itemBtn.show})
- // 编辑
- function updateHandle(record) {
- buildRowRelation();
- record.rowEdit = true;
- }
- #end
- #if(${itemBtn.value}=="detail" && ${itemBtn.show})
- // 查看详情
- function goDetail(record) {
- #if(${context.isFlow})
- // 带流程
- const data = {
- id: record.flowTaskId,
- flowId: state.flowId,
- opType: 0,
- status: record.flowState,
- };
- openFlowParser(true, data);
- #else
- // 不带流程
- const data = {
- id: record.id,
- };
- detailRef.value?.init(data);
- #end
- }
- #end
- #if(${itemBtn.value}=="remove" && ${itemBtn.show})
- // 删除
- function handleDelete(id) {
- const query={ids:[id] #if(${context.isFlow}) ,flowId:state.flowId #end}
- batchDelete(query).then((res) => {
- createMessage.success(res.msg);
- clearSelectedRowKeys();
- reload();
- });
- }
- #end
- #end
- ##表头按键方法
- #foreach($itemBtn in ${context.btnPcList})
- #if(${itemBtn.value}=="add" && ${itemBtn.show})
- // 新增
- function addHandle() {
- buildRowRelation();
- let record = { rowEdit: true, id: 'jnpfAdd', #EditDataform() };
- insertTableDataRecord(record, 0);
- }
- #end
- #if(${itemBtn.value}=="upload" && ${itemBtn.show})
- #end
- #if(${itemBtn.value}=="download" && ${itemBtn.show})
- // 导出
- function handleDownload(data) {
- let query = { ...getFetchParams(), ...data };
- exportData(query)
- .then((res) => {
- setExportModalProps({ confirmLoading: false });
- if (!res.data.url) return;
- downloadByUrl({ url: res.data.url });
- closeExportModal();
- })
- .catch(() => {
- setExportModalProps({ confirmLoading: false });
- });
- }
- #end
- #if(${itemBtn.value}=="batchRemove" && ${itemBtn.show})
- // 批量删除
- function handelBatchRemove() {
- const ids = getSelectRowKeys();
- if (!ids.length) return createMessage.error('请选择一条数据');
- createConfirm({
- iconType: 'warning',
- title: $t('common.tipTitle'),
- content: '您确定要删除这些数据吗, 是否继续?',
- onOk: () => {
- const query={ids:ids #if(${context.isFlow}) ,flowId:state.flowId #end}
- batchDelete(query).then((res) => {
- createMessage.success(res.msg);
- clearSelectedRowKeys();
- reload();
- });
- },
- });
- }
- #end
- #if(${itemBtn.value}=="batchPrint" && ${itemBtn.show})
- //打印方法
- function handelBatchPrint() {
- let printIds=#if(${context.columnData.printIds}) ${context.columnData.printIds} #else [] #end
- if (!printIds?.length) return createMessage.error('未配置打印模板');
- const ids = getSelectRowKeys();
- if (!ids.length) return createMessage.error('请选择一条数据');
- if (printIds?.length === 1) return handleShowBrowse(printIds[0]);
- openPrintSelect(true, printIds);
- }
- function handleShowBrowse(id) {
- const formInfo: any[] = (getSelectRows() || []).map(o => {
- const item: any = { formId: o.id };
- #if(${context.isFlow})
- item.flowTaskId = o.flowTaskId || o.id;
- #end
- return item;
- });
- openPrintBrowse(true, { id, formInfo });
- }
- #end
- #end
- async function init() {
- state.config = {};
- searchInfo.menuId = route.meta.modelId as string;
- state.columnList = columnList;
- #if(${context.groupTable})
- // 分组
- state.columnList = state.columnList.filter((o) => o.prop != '${context.groupField}');
- #end
- setLoading(true);
- getSearchSchemas();
- getColumnList();
- await initViewList();
- buildOptions();
- ## 列表标签面板初始化
- #if(${context.tabConfig.createTab})
- getTabList();
- #else
- nextTick(() => {
- unref(getSearchList)?.length ? searchFormSubmit() : handleSearchSubmit({});
- });
- #end
- }
- function getSearchSchemas() {
- const schemas = getSearchFormSchemas(searchList #if(${context.isFlow}),true#end);
- state.searchSchemas = schemas;
- }
- function buildSearchOptions(schemas){
- schemas.forEach((cur) => {
- const config = cur.__config__;
- if (dyOptionsList.includes(config.jnpfKey)) {
- if (config.dataType === 'dictionary') {
- if (!config.dictionaryType) return;
- getDictionaryDataSelector(config.dictionaryType).then((res) => {
- updateSchema([{ field: cur.field, componentProps: { options: res.data.list } }]);
- });
- }
- if (config.dataType === 'dynamic') {
- if (!config.propsUrl) return;
- const query = { paramList: getParamList(config.templateJson) };
- getDataInterfaceRes(config.propsUrl, query).then((res) => {
- const data = Array.isArray(res.data) ? res.data : [];
- updateSchema([{ field: cur.field, componentProps: { options: data } }]);
- });
- }
- }
- cur.defaultValue = cur.value;
- });
- }
- function getColumnList() {
- #if(${context.columnData.useColumnPermission})
- // 开启列表过滤权限
- let columnList: any[] = [];
- const list = permissionList.filter(o => o.modelId === searchInfo.menuId);
- const perColumnList = list[0] && list[0].column ? list[0].column : [];
- for (let i = 0; i < state.columnList.length; i++) {
- inner: for (let j = 0; j < perColumnList.length; j++) {
- if (state.columnList[i].prop === perColumnList[j].enCode) {
- columnList.push(state.columnList[i]);
- break inner;
- }
- }
- }
- #else
- // 没有开启列表权限
- let columnList = state.columnList;
- #end
- state.exportList = columnList.filter(o => !o.prop.includes('-'));
- let columns = columnList.map((o) => {
- const item:any = {
- ...o,
- placeholder: o.placeholderI18nCode ? $t(o.placeholderI18nCode, o.placeholder) : o.placeholder,
- title: o.labelI18nCode ? $t(o.labelI18nCode, o.label) : o.label,
- dataIndex: o.prop,
- align: o.align,
- fixed: o.fixed == 'none' ? false : o.fixed,
- sortable: o.sortable,
- width: o.width || '',
- minWidth: o.width || 100,
- slots: { default: o.prop },
- }
- return item;
- });
- state.allColumns = columns;
- //复杂表头
- columns = getComplexColumns(columns);
- state.columns = columns.filter((o) => !o.prop.includes('-'));
- }
- #if(${context.tabConfig.createTab})
- //标签初始化
- async function getTabList() {
- #if(${context.tabConfig.fieldsModel})
- #set($fm =${context.tabConfig.fieldsModel})
- #set($config =$fm.config)
- #if(${config.dataType} == 'dictionary')
- // 字典
- const data = (await baseStore.getDicDataSelector('${config.dictionaryType}'))
- const options = #if($fm.props.value == 'enCode') data.map(o => ({ ...o, id: o.enCode }))#else data #end;
- state.tabList = [...state.tabList,...options]
- #end
- #if(${config.dataType} == 'static')
- //静态
- state.tabList = #if(${fm.options}) ${fm.options} #else[] #end
- #end
- #end
- #if(${context.tabConfig.hasAllTab})
- state.tabList.unshift({ fullName: '全部', id: '' });
- #end
- state.tabActiveKey = state.tabList[0].id || '';
- state.tabQueryJson = { ${context.tabConfig.relationField} : state.tabList[0].id };
- nextTick(() => {
- unref(getSearchList)?.length? searchFormSubmit() : reload({ page: 1 });
- });
- }
- #end
- //复杂表头
- function getComplexColumns(columns) {
- //这里生成复杂表头的配置
- let complexHeaderList: any[] = #if(${context.complexHeaderList}) ${context.complexHeaderList}; #else []; #end
- if (!complexHeaderList.length) return columns;
- let childColumns: any[] = [];
- let firstChildColumns: string[] = [];
- for (let i = 0; i < complexHeaderList.length; i++) {
- const e = complexHeaderList[i];
- e.label = e.fullName;
- e.labelI18nCode = e.fullNameI18nCode;
- e.title = e.fullNameI18nCode ? $t(e.fullNameI18nCode, e.fullName) : e.fullName;
- e.align = e.align;
- e.dataIndex = e.id;
- e.prop = e.id;
- e.children = [];
- e.jnpfKey = 'complexHeader';
- if (e.childColumns?.length) {
- childColumns.push(...e.childColumns);
- for (let k = 0; k < e.childColumns.length; k++) {
- const item = e.childColumns[k];
- for (let j = 0; j < columns.length; j++) {
- const o = columns[j];
- if (o.prop == item && o.fixed !== 'left' && o.fixed !== 'right') e.children.push({ ...omit(o, ['fixed']) });
- }
- }
- }
- if (e.children.length) firstChildColumns.push(e.children[0].prop);
- }
- complexHeaderList = complexHeaderList.filter(o => o.children.length);
- let list: any[] = [];
- for (let i = 0; i < columns.length; i++) {
- const e = columns[i];
- if (!childColumns.includes(e.prop)) {
- list.push(e);
- } else {
- if (firstChildColumns.includes(e.prop)) {
- const item = complexHeaderList.find(o => o.childColumns.includes(e.prop));
- list.push(item);
- }
- }
- }
- return list;
- }
- // 关联表单查看详情
- function toDetail(modelId, id, propsValue) {
- if (!id) return;
- getConfigData(modelId).then((res) => {
- if (!res.data || !res.data.formData) return;
- const formConf = JSON.parse(res.data.formData);
- formConf.popupType = 'general';
- formConf.hasPrintBtn = false;
- formConf.customBtns = [];
- const data = { id, formConf, modelId , propsValue};
- relationDetailRef.value?.init(data);
- });
- }
- function handleColumnChange(data) {
- state.columnSettingList = data;
- }
- ##高级查询
- #if(${context.superQuery})
- // 高级查询
- function handleSuperQuery(superQueryJson) {
- searchInfo.superQueryJson = superQueryJson;
- reload({ page: 1 });
- }
- #end
- ##有普通查询
- function handleSearchReset() {
- searchFormSubmit();
- }
- function handleSearchSubmit(data) {
- clearSelectedRowKeys();
- let obj = {
- ...defaultSearchInfo,
- superQueryJson: searchInfo.superQueryJson,
- ...data,
- #if(${context.tabConfig.createTab})
- ...state.tabQueryJson,
- #end
- };
- Object.keys(searchInfo).map(key => {
- delete searchInfo[key];
- return key;
- });
- for (let [key, value] of Object.entries(obj)) {
- searchInfo[key.replaceAll('-', '_')] = value;
- }
- console.log(searchInfo);
- reload({ page: 1 });
- }
- ##列表标签切换方法
- #if(${context.tabConfig.createTab})
- function onTabChange(val) {
- state.tabQueryJson = { ${context.tabConfig.relationField} : val }; //这个key是取json中的tabConfig.relationFiled
- unref(getSearchList).length?searchFormSubmit():resetFields()
- }
- #end
- // 行内编辑获取选项
- function buildOptions() {
- const loop = list => {
- for (let i = 0; i < list.length; i++) {
- const cur = list[i];
- if (cur.children?.length) loop(cur.children);
- const config = cur.__config__;
- if (!config) continue;
- if (dyOptionsList.includes(config.jnpfKey)) {
- if (config.dataType === 'dictionary') {
- if (!config.dictionaryType) return;
- baseStore.getDicDataSelector(config.dictionaryType).then(res => {
- cur.options = res;
- });
- }
- if (config.dataType === 'dynamic') {
- if (!config.propsUrl) return;
- const query = { paramList: getParamList(config.templateJson) };
- getDataInterfaceRes(config.propsUrl, query).then(res => {
- cur.options = Array.isArray(res.data) ? res.data : [];
- });
- }
- }
- }
- };
- loop(state.columns);
- }
- #if(!$context.isFlow)
- function handleRowForm(record) {
- const data = {
- id: record.id,
- menuId: searchInfo.menuId,
- formData: record,
- };
- extraFormRef.value?.init(data);
- }
- #end
- ##动态时间处理
- function buildRowRelation() {
- const loop = list => {
- for (let i = 0; i < list.length; i++) {
- let cur = list[i];
- if (cur.children?.length) loop(cur.children);
- const config = cur?.__config__;
- if (!config) continue;
- if (config.jnpfKey === 'datePicker') {
- if (config.startTimeRule) {
- if (config.startTimeType == 1) cur.startTime = config.startTimeValue;
- if (config.startTimeType == 3) cur.startTime = new Date().getTime();
- if (config.startTimeType == 4 || config.startTimeType == 5) {
- const type = getTimeUnit(config.startTimeTarget);
- const method = config.startTimeType == 4 ? 'subtract' : 'add';
- const startTime = dayjs()[method](config.startTimeValue, type);
- let realStartTime = startTime.startOf('day').valueOf();
- if (config.startTimeTarget == 4) realStartTime = startTime.startOf('minute').valueOf();
- if (config.startTimeTarget == 5) realStartTime = startTime.startOf('second').valueOf();
- if (config.startTimeTarget == 6) realStartTime = startTime.valueOf();
- cur.startTime = realStartTime;
- }
- }
- if (config.endTimeRule) {
- if (config.endTimeType == 1) cur.endTime = config.endTimeValue;
- if (config.endTimeType == 3) cur.endTime = new Date().getTime();
- if (config.endTimeType == 4 || config.endTimeType == 5) {
- const type = getTimeUnit(config.endTimeTarget);
- const method = config.endTimeType == 4 ? 'subtract' : 'add';
- const endTime = dayjs()[method](config.endTimeValue, type);
- let realEndTime = endTime.endOf('day').valueOf();
- if (config.endTimeTarget == 4) realEndTime = endTime.endOf('minute').valueOf();
- if (config.endTimeTarget == 5) realEndTime = endTime.endOf('second').valueOf();
- if (config.endTimeTarget == 6) realEndTime = endTime.valueOf();
- cur.endTime = realEndTime;
- }
- }
- }
- if (config.jnpfKey === 'timePicker') {
- if (config.startTimeRule) {
- if (config.startTimeType == 1) cur.startTime = config.startTimeValue || null;
- if (config.startTimeType == 3) cur.startTime = dayjs().format(cur.format);
- if (config.startTimeType == 4 || config.startTimeType == 5) {
- const type = getTimeUnit(config.startTimeTarget + 3);
- const method = config.startTimeType == 4 ? 'subtract' : 'add';
- const startTime = dayjs()[method](config.startTimeValue, type).format(cur.format);
- cur.startTime = startTime;
- }
- }
- if (config.endTimeRule) {
- if (config.endTimeType == 1) cur.endTime = config.endTimeValue || null;
- if (config.endTimeType == 3) cur.endTime = dayjs().format(cur.format);
- if (config.endTimeType == 4 || config.endTimeType == 5) {
- const type = getTimeUnit(config.endTimeTarget + 3);
- const method = config.endTimeType == 4 ? 'subtract' : 'add';
- const endTime = dayjs()[method](config.endTimeValue, type).format(cur.format);
- cur.endTime = endTime;
- }
- }
- }
- }
- };
- loop(state.columns);
- }
- #if(${context.isFlow})
- function getFlowId(){
- if(!state.flowId){
- createMessage.error('流程模板的flowId未填写')
- closeCurrentTab();
- router.replace('/404');
- return
- }
- getFlowStartFormId(state.flowId).then(res => {
- init()
- }).catch(() => {
- closeCurrentTab();
- router.replace('/404');
- });
- }
- #end
- async function initViewList(currentId = '') {
- const query = {
- menuId: route.meta.modelId,
- };
- await getViewList(query).then(res => {
- const columns : any[]= state.columns;
- const searchList: any[] = state.searchSchemas.map(o => ({ label: o.label, id: o.field, show: o.show, labelI18nCode: o.labelI18nCode }));
- const columnList: any[] = columns.map(o => ({ label: o.label, id: o.prop, show: true, fixed: o.fixed || 'none', labelI18nCode: o.labelI18nCode }));
- state.viewList = (res.data || []).map(o => {
- if (o.type == 0) return { ...o, searchList, columnList };
- return { ...o, searchList: o.searchList ? JSON.parse(o.searchList) : [], columnList: o.columnList ? JSON.parse(o.columnList) : [] };
- });
- if (currentId) {
- state.currentView = state.viewList.filter(o => o.id === currentId)[0] || state.viewList[0];
- } else {
- state.currentView = state.viewList.filter(o => o.status === 1)[0] || state.viewList[0];
- }
- });
- }
- function handleViewClick(item) {
- state.currentView = item;
- }
- function setListValue(data: any[] = [], defaultData: any[] = [], key) {
- let list: any[] = [];
- for (let i = 0; i < data.length; i++) {
- for (let j = 0; j < defaultData.length; j++) {
- if (data[i].show && data[i].id == defaultData[j][key]) list.push(defaultData[j]);
- }
- }
- return list;
- }
- #if(${context.columnData.resizable})
- function handleColumnResizableChange({ resizeColumn, resizeWidth }) {
- if (!resizeColumn.field || !resizeColumn.field.includes('-')) return;
- const tableVModel = resizeColumn.field.split('-')[0];
- setTimeout(() => {
- for (let i = 0; i < state.childColumnList.length; i++) {
- const element = state.childColumnList[i];
- if (element.prop == tableVModel) {
- for (let j = 0; j < element.children.length; j++) {
- const item = element.children[j];
- if (item.prop == resizeColumn.field) {
- item.width = resizeWidth;
- return;
- }
- }
- }
- }
- }, 0);
- }
- #end
- onMounted(() => {
- #if(${context.isFlow})
- getFlowId()
- #else
- init();
- #end
- });
- </script>
- <template>
- <div class="jnpf-content-wrapper">
- <div class="jnpf-content-wrapper-center">
- ## <!-- 有搜索 -->
- <div class="jnpf-content-wrapper-search-box" v-if="getSearchList.length">
- <BasicForm @register="registerSearchForm" :schemas="getSearchList"
- @advanced-change="redoHeight" @submit="handleSearchSubmit" @reset="handleSearchReset"
- class="search-form">
- </BasicForm>
- </div>
- <div class="jnpf-content-wrapper-content jnpf-content-wrapper-list">
- ## <!-- 列表标签面板 -->
- #if(${context.tabConfig.createTab})
- <a-tabs v-model:activeKey="state.tabActiveKey" class="jnpf-content-wrapper-tabs"
- destroyInactiveTabPane @change="onTabChange">
- <a-tab-pane v-for="item in state.tabList" :key="item.id" :tab="item.fullName"></a-tab-pane>
- </a-tabs>
- #end
- <BasicVxeTable @register="registerTable" v-bind="getTableBindValue" ref="tableRef"
- @columns-change="handleColumnChange" #if(${context.columnData.resizable}) @column-resizable-change="handleColumnResizableChange" #end>
- #if(${context.btnPcList.size()}>0)
- <template #tableTitle>
- #foreach($btn in ${context.btnPcList})
- #if(${btn.value}=='add' && ${btn.show})
- <a-button type="primary" preIcon="${btn.icon}" #if(${context.columnData.useBtnPermission}) v-auth="'btn_${btn.value}'" #end
- @click="addHandle()">#if(${btn.labelI18nCode})
- {{$t('${btn.labelI18nCode}','${btn.label}')}}#else${btn.label}#end</a-button>
- #end
- #if(${btn.value}=='download' && ${btn.show})
- <a-button type="link" preIcon="${btn.icon}" #if(${context.columnData.useBtnPermission}) v-auth="'btn_${btn.value}'" #end
- @click="openExportModal(true, { columnList: state.exportList, selectIds: getSelectRowKeys() })">#if(${btn.labelI18nCode})
- {{$t('${btn.labelI18nCode}','${btn.label}')}}#else${btn.label}#end</a-button>
- #end
- #if(${btn.value}=='upload' && ${btn.show})
- <a-button type="link" preIcon="${btn.icon}" #if(${context.columnData.useBtnPermission}) v-auth="'btn_${btn.value}'" #end
- @click="openImportModal(true, { url: '${context.module}/${context.className}', menuId: searchInfo.menuId #if($!{context.isFlow}), flowId: state.flowId#end })">#if(${btn.labelI18nCode})
- {{$t('${btn.labelI18nCode}','${btn.label}')}}#else${btn.label}#end</a-button>
- #end
- #if(${btn.value}=='batchRemove' && ${btn.show})
- <a-button type="link" preIcon="${btn.icon}" #if(${context.columnData.useBtnPermission}) v-auth="'btn_${btn.value}'" #end
- @click="handelBatchRemove()">#if(${btn.labelI18nCode})
- {{$t('${btn.labelI18nCode}','${btn.label}')}}#else${btn.label}#end</a-button>
- #end
- #if(${btn.value}=='batchPrint' && ${btn.show})
- <a-button type="link" preIcon="${btn.icon}" #if(${context.columnData.useBtnPermission}) v-auth="'btn_${btn.value}'" #end
- @click="handelBatchPrint()">#if(${btn.labelI18nCode})
- {{$t('${btn.labelI18nCode}','${btn.label}')}}#else${btn.label}#end</a-button>
- #end
- #end
- </template>
- #end
- ## <!-- 有高级查询:开始 -->
- #if(${context.superQuery})
- <template #toolbar>
- <a-tooltip placement="top">
- <template #title>
- <span>{{ $t('common.superQuery') }}</span>
- </template>
- <filter-outlined @click="openSuperQuery(true, { columnOptions: superQueryJson })" />
- </a-tooltip>
- </template>
- #end
- <template #toolbarAfter>
- <ViewList :menuId="searchInfo.menuId" :viewList="viewList" @itemClick="handleViewClick" @reload="initViewList" />
- <ViewSetting :menuId="searchInfo.menuId" :viewList="viewList" :currentView="currentView" @reload="initViewList" />
- </template>
- ## <!-- 有高级查询:结束 -->
- #if(!${context.isFlow})
- <template #editIndex="{ record, index }">
- <div class="edit-row-action">
- <span class="edit-row-index">{{ index + 1 }}</span>
- <i class="ym-custom ym-custom-arrow-expand" @click="handleRowForm(record)"></i>
- </div>
- </template>
- #end
- <template #[column.prop]="{ record }" v-for="column in allColumns" :key="column.prop">
- <template v-if="record.rowEdit">
- <template v-if="column.jnpfKey === 'inputNumber'">
- <jnpf-input-number
- v-model:value="record[column.prop]"
- :placeholder="column.placeholder"
- :min="column.min"
- :max="column.max"
- :step="column.step"
- :controls="column.controls"
- :addonBefore="column.addonBefore"
- :addonAfter="column.addonAfter"
- :precision="column.precision"
- :thousands="column.thousands"
- :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'calculate'">
- <jnpf-calculate
- v-model:value="record[column.prop]"
- :isStorage="column.isStorage"
- :precision="column.precision"
- :thousands="column.thousands"
- detailed />
- </template>
- <template v-else-if="column.jnpfKey === 'rate'">
- <jnpf-rate v-model:value="record[column.prop]" :count="column.count" :allowHalf="column.allowHalf" :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'slider'">
- <jnpf-slider v-model:value="record[column.prop]" :min="column.min" :max="column.max" :step="column.step" :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'uploadImg'">
- <jnpf-upload-img
- v-model:value="record[column.prop]"
- :fileSize="column.fileSize"
- :sizeUnit="column.sizeUnit"
- :limit="column.limit"
- :pathType="column.pathType"
- :sortRule="column.sortRule"
- :timeFormat="column.timeFormat"
- :folder="column.folder"
- :tipText="column.tipText"
- :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'uploadFile'">
- <jnpf-upload-file
- v-model:value="record[column.prop]"
- :accept="column.accept"
- :fileSize="column.fileSize"
- :sizeUnit="column.sizeUnit"
- :buttonText="column.buttonText"
- :limit="column.limit"
- :pathType="column.pathType"
- :sortRule="column.sortRule"
- :timeFormat="column.timeFormat"
- :folder="column.folder"
- :tipText="column.tipText"
- :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'switch'">
- <jnpf-switch v-model:value="record[column.prop]" :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'timePicker'">
- <jnpf-time-picker v-model:value="record[column.prop]" :format="column.format"
- :placeholder="column.placeholder" :allowClear="column.clearable"
- :startTime="column.startTime" :endTime="column.endTime"
- :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'datePicker'">
- <jnpf-date-picker v-model:value="record[column.prop]" :type="column.type"
- :allowClear="column.clearable" :placeholder="column.placeholder"
- :startTime="column.startTime" :endTime="column.endTime"
- :format="column.format" :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'organizeSelect'">
- <jnpf-organize-select v-model:value="record[column.prop]"
- :placeholder="column.placeholder" :multiple="column.multiple"
- :allowClear="column.clearable" :disabled="column.disabled"
- :selectType="column.selectType" :ableIds="column.ableIds" />
- </template>
- <template v-else-if="column.jnpfKey === 'roleSelect'">
- <jnpf-role-select v-model:value="record[column.prop]"
- :placeholder="column.placeholder" :multiple="column.multiple"
- :allowClear="column.clearable" :disabled="column.disabled"
- :selectType="column.selectType" :ableIds="column.ableIds" />
- </template>
- <template v-else-if="column.jnpfKey === 'groupSelect'">
- <jnpf-group-select v-model:value="record[column.prop]"
- :placeholder="column.placeholder" :multiple="column.multiple"
- :allowClear="column.clearable" :disabled="column.disabled"
- :selectType="column.selectType" :ableIds="column.ableIds" />
- </template>
- <template v-else-if="column.jnpfKey === 'posSelect'">
- <jnpf-pos-select v-model:value="record[column.prop]"
- :placeholder="column.placeholder" :multiple="column.multiple"
- :allowClear="column.clearable" :disabled="column.disabled"
- :selectType="column.selectType" :ableIds="column.ableIds" />
- </template>
- <template v-else-if="column.jnpfKey === 'userSelect'">
- <jnpf-user-select v-model:value="record[column.prop]"
- :placeholder="column.placeholder" :multiple="column.multiple"
- :allowClear="column.clearable" :disabled="column.disabled"
- :selectType="['all', 'custom'].includes(column.selectType) ? column.selectType : 'all'"
- :ableIds="column.ableIds" />
- </template>
- <template v-else-if="column.jnpfKey === 'usersSelect'">
- <jnpf-users-select v-model:value="record[column.prop]"
- :placeholder="column.placeholder" :multiple="column.multiple"
- :allowClear="column.clearable" :disabled="column.disabled"
- :selectType="column.selectType" :ableIds="column.ableIds" />
- </template>
- <template v-else-if="column.jnpfKey === 'areaSelect'">
- <jnpf-area-select v-model:value="record[column.prop]" :level="column.level"
- :placeholder="column.placeholder" :multiple="column.multiple"
- :allowClear="column.clearable" :disabled="column.disabled" />
- </template>
- <template v-else-if="['select', 'radio', 'checkbox'].includes(column.jnpfKey)">
- <jnpf-select v-model:value="record[column.prop]" :placeholder="column.placeholder"
- :multiple="column.multiple || column.jnpfKey === 'checkbox'"
- :allowClear="column.clearable || ['radio', 'checkbox'].includes(column.jnpfKey)" :showSearch="column.filterable"
- :disabled="column.disabled" :options="column.options"
- :fieldNames="column.props" />
- </template>
- <template v-else-if="column.jnpfKey === 'cascader'">
- <jnpf-cascader v-model:value="record[column.prop]" :placeholder="column.placeholder"
- :multiple="column.multiple" :allowClear="column.clearable"
- :showSearch="column.filterable" :disabled="column.disabled"
- :options="column.options" :fieldNames="column.props"
- :showAllLevels="column.showAllLevels" />
- </template>
- <template v-else-if="column.jnpfKey === 'treeSelect'">
- <jnpf-tree-select v-model:value="record[column.prop]"
- :placeholder="column.placeholder" :multiple="column.multiple"
- :allowClear="column.clearable" :showSearch="column.filterable"
- :disabled="column.disabled" :options="column.options"
- :fieldNames="column.props" />
- </template>
- <template v-else-if="column.jnpfKey === 'relationForm'">
- <jnpf-relation-form v-model:value="record[column.prop]"
- :placeholder="column.placeholder" :allowClear="column.clearable"
- :disabled="column.disabled" :modelId="column.modelId"
- :columnOptions="column.columnOptions" :relationField="column.relationField"
- :hasPage="column.hasPage" :pageSize="column.pageSize"
- :popupType="column.popupType" :popupTitle="column.popupTitle"
- :popupWidth="column.popupWidth" :queryType="column.queryType"
- :propsValue="column.propsValue"/>
- </template>
- <template
- v-else-if="column.jnpfKey === 'popupSelect' || column.jnpfKey === 'popupTableSelect'">
- <jnpf-popup-select v-model:value="record[column.prop]"
- :placeholder="column.placeholder" :multiple="column.multiple"
- :allowClear="column.clearable" :disabled="column.disabled"
- :interfaceId="column.interfaceId" :columnOptions="column.columnOptions"
- :propsValue="column.propsValue" :relationField="column.relationField"
- :hasPage="column.hasPage" :pageSize="column.pageSize"
- :popupType="column.popupType" :popupTitle="column.popupTitle"
- :templateJson="column.templateJson"
- :popupWidth="column.popupWidth" />
- </template>
- <template v-else-if="column.jnpfKey === 'autoComplete'">
- <jnpf-auto-complete
- v-model:value="record[column.prop]"
- :placeholder="column.placeholder"
- :allowClear="column.clearable"
- :disabled="column.disabled"
- :interfaceId="column.interfaceId"
- :relationField="column.relationField"
- :templateJson="column.templateJson"
- :total="column.total" />
- </template>
- <template v-else-if="['input', 'textarea'].includes(column.jnpfKey)">
- <jnpf-input v-model:value="record[column.prop]" :placeholder="column.placeholder"
- :allowClear="column.clearable" :disabled="column.disabled"
- :readonly="column.readonly" :prefixIcon="column.prefixIcon"
- :suffixIcon="column.suffixIcon" :addonBefore="column.addonBefore"
- :addonAfter="column.addonAfter" :maxlength="column.maxlength"
- :showPassword="column.showPassword" :showCount="column.showCount">
- </jnpf-input>
- </template>
- <template v-else-if="column.jnpfKey === 'location'">
- <jnpf-location
- v-model:value="record[column.prop]"
- :autoLocation="column.autoLocation"
- :enableLocationScope="column.enableLocationScope"
- :adjustmentScope="column.adjustmentScope"
- :enableDesktopLocation="column.enableDesktopLocation"
- :locationScope="column.locationScope"
- :clearable="column.clearable"
- :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'sign'">
- <jnpf-sign v-model:value="record[column.prop]" :isInvoke="column.isInvoke" :disabled="column.disabled" />
- </template>
- <template v-else-if="column.jnpfKey === 'signature'">
- <jnpf-signature v-model:value="record[column.prop]" :disabled="column.disabled" :ableIds="column.ableIds"/>
- </template>
- <template v-else-if="systemComponentsList.includes(column.jnpfKey)">
- {{ record[column.prop + '_name'] || record[column.prop] }}
- </template>
- <template v-else>
- {{ record[column.prop] }}
- </template>
- </template>
- <template v-else>
- <template v-if="column.jnpfKey === 'inputNumber'">
- <jnpf-input-number v-model:value="record[column.prop + '_name']" :precision="column.precision" :thousands="column.thousands" disabled detailed />
- </template>
- <template v-else-if="column.jnpfKey === 'calculate'">
- <jnpf-calculate
- v-model:value="record[column.prop]"
- :isStorage="column.isStorage"
- :precision="column.precision"
- :thousands="column.thousands"
- detailed />
- </template>
- <template v-else-if="column.jnpfKey === 'relationForm'">
- <p class="link-text" @click="toDetail(column.modelId, record[`${column.prop}_id`], column.propsValue)">
- {{ record[column.prop + '_name'] || record[column.prop] }}
- </p>
- </template>
- <template v-else-if="column.jnpfKey === 'sign'">
- <jnpf-sign v-model:value="record[column.prop + '_name']" detailed />
- </template>
- <template v-else-if="column.jnpfKey === 'signature'">
- <jnpf-signature v-model:value="record[column.prop + '_name']" detailed />
- </template>
- <template v-else-if="column.jnpfKey === 'rate'">
- <jnpf-rate v-model:value="record[column.prop + '_name']" :count="column.count" :allowHalf="column.allowHalf" disabled />
- </template>
- <template v-else-if="column.jnpfKey === 'slider'">
- <jnpf-slider v-model:value="record[column.prop + '_name']" :min="column.min" :max="column.max" :step="column.step" disabled />
- </template>
- <template v-else-if="column.jnpfKey === 'uploadImg'">
- <jnpf-upload-img v-model:value="record[column.prop + '_name']" disabled detailed simple v-if="record[column.prop]?.length" />
- </template>
- <template v-else-if="column.jnpfKey === 'uploadFile'">
- <jnpf-upload-file v-model:value="record[column.prop + '_name']" disabled detailed simple v-if="record[column.prop]?.length" />
- </template>
- <template v-else-if="column.jnpfKey === 'input'">
- <jnpf-input
- v-model:value="record[column.prop + '_name']"
- :useMask="column.useMask"
- :maskConfig="column.maskConfig"
- :showOverflow="#if(${context.columnData.showOverflow})${context.columnData.showOverflow} #else false #end"
- detailed />
- </template>
- <template v-else>
- {{ record[column.prop + '_name'] || record[column.prop] }}
- </template>
- </template>
- </template>
- ## <!-- 有工作流:开始 -->
- #if($!{context.isFlow})
- <template #flowState="{ record }">
- <JnpfTextTag :content="getFlowStatusContent(record.flowState)" :color="getFlowStatusColor(record.flowState)" />
- </template>
- #end
- ## <!-- 有工作流:结束 -->
- <template #action="{ record, index }">
- <TableAction :actions="getTableActions(record,index)" />
- </template>
- </BasicVxeTable>
- </div>
- </div>
- #if(!$context.isFlow)
- <ExtraForm ref="extraFormRef" @reload="reload" />
- #end
- #foreach($itemBtn in ${context.columnBtnPcList})
- #if(!${context.isFlow} && ${itemBtn.value}=="detail")
- ## <!-- 有详情:开始 -->
- <Detail ref="detailRef" />
- #end
- #if(${itemBtn.value}=="edit")
- #end
- #if(${itemBtn.value}=="remove")
- #end
- #end
- <!-- 有关联表单详情:开始 -->
- <RelationDetail ref="relationDetailRef" />
- <!-- 有关联表单详情:结束 -->
- #foreach($itemBtn in ${context.btnPcList})
- #if(${itemBtn.value}=="add")
- #end
- #if(${itemBtn.value}=="upload")
- <ImportModal @register="registerImportModal" @reload="reload" />
- #end
- #if(${itemBtn.value}=="download")
- <ExportModal @register="registerExportModal" @download="handleDownload" />
- #end
- #if(${itemBtn.value}=="batchRemove")
- #end
- #if(${itemBtn.value}=="batchPrint")
- <PrintSelect @register="registerPrintSelect" @change="handleShowBrowse" />
- <PrintBrowse @register="registerPrintBrowse" />
- #end
- #end
- #if(${context.superQuery})
- ## <!-- 有高级查询 -->
- <SuperQueryModal @register="registerSuperQueryModal" @superQuery="handleSuperQuery" />
- #end
- #if(${context.isFlow})
- ## <!-- 带流程:开始 -->
- <CandidateModal @register="registerCandidate" @confirm="submitCandidate" />
- <FlowParser @register="registerFlowParser" @reload="reload" />
- #end
- </div>
- </template>
|