| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- <template>
- <TabFormEditModal
- v-if="openTabEditModal" v-model:open="openTabEditModal"
- :uuid="uuid" :is-restore-data="tabEditViewIsRestoreData"
- :window-no="mCurdWindowNo" :tab-index="mTabIndex" :type="tabEditViewType" :model-data-id="tabEditViewRecordId"
- width="90%" :current-page="tabEditViewCurrentPage" :current-index="tabEditViewCurrentIndex"
- :total-records="tabEditViewTotalRecords" :task-info-id="tabEditViewTaskInfoId"
- :simple-filter-params="tabEditViewSimpleFilterParams" :complex-filter-params="tabEditViewComplexFilterParams"
- :workflow-type="tabEditViewWorkflowType" :mask-closable="false" :model-data-create="modelDataCreate"
- :sort-str="tabEditViewSortStr" @open-tab-form-view="openTabFormView"
- />
- <TabFormViewModal
- v-if="openTabViewModal" v-model:open="openTabViewModal"
- :uuid="uuid" :window-no="mCurdWindowNo" :tab-index="mTabIndex"
- :type="tabFormViewType" :model-data-id="tabFormViewRecordId" width="90%" :current-page="tabFormViewCurrentPage"
- :current-index="tabFormViewCurrentIndex" :total-records="tabFormViewTotalRecords" :simple-filter-params="tabFormViewSimpleFilterParams"
- :task-info-id="tabFormViewTaskInfoId" :workflow-type="tabFormViewWorkflowType" :mask-closable="false" :complex-filter-params="tabFormViewComplexFilterParams"
- :sort-str="tabFormViewSortStr" @open-tab-edit-view="openTabEditView"
- />
- </template>
- <script setup>
- import { ref, onMounted, defineEmits, watch, defineProps } from 'vue';
- import TabFormEditModal from './tabFormEdit/TabFormEditModal.vue';
- import TabFormViewModal from './tabFormView/TabFormViewModal.vue';
- const props = defineProps({
- // 是否打开
- open: {
- type: Boolean,
- default: false,
- },
- // 窗口类型
- // Edit:编辑界面,可选项如下(create:创建数据,edit:编辑数据,editRestore:恢复数据)
- // View:表单界面,可选项如下(view:视图数据,viewRestore:恢复数据)
- viewType: {
- type: String,
- default: '',
- },
- // CURD窗口编号
- curdWindowNo: {
- type: String,
- default: '',
- },
- // 页签编号
- tabIndex: {
- type: Number,
- default: 0,
- },
- // 数据记录Id
- modelDataId: {
- type: Number,
- default: null,
- },
- // 当前记录所在的页码
- currentPage: {
- type: Number,
- default: 0,
- },
- // 当前记录的排序
- currentIndex: {
- type: Number,
- default: 0,
- },
- // 记录的总数量
- totalRecords: {
- type: Number,
- default: 0,
- },
- // 窗口唯一Id(必须是唯一的)
- uuid: {
- type: String,
- default: '',
- },
- // 是否恢复草稿数据(false:不恢复,true:恢复)
- isRestoreData: {
- type: Boolean,
- default: false,
- },
- // 工作流任务Id(taskId)
- taskInfoId: {
- type: String,
- default: null,
- },
- // 工作流任务类型(approve:审批任务,copyTask:抄送任务)
- workflowType: {
- type: String,
- default: null,
- },
- sortStr: {
- type: String,
- default: null,
- },
- simpleFilterParams: {
- type: String,
- default: null,
- },
- complexFilterParams: {
- type: Object,
- default: null,
- },
- // 创建新数据时,填充已知的值FieldValue
- modelDataCreate: {
- type: Object,
- default: function(){
- return {};
- },
- },
- });
- const mCurdWindowNo = ref(null);
- const mTabIndex = ref(0);
- const openTabEditModal = ref(false);
- const tabEditViewType = ref('create');
- const tabEditViewRecordId = ref(null);
- const tabEditViewCurrentPage = ref(null);
- const tabEditViewCurrentIndex = ref(null);
- const tabEditViewTotalRecords = ref(null);
- const tabEditViewIsRestoreData = ref(false);
- const tabEditViewTaskInfoId = ref(null);
- const tabEditViewWorkflowType = ref(null);
- const tabEditViewSortStr = ref(null);
- const tabEditViewSimpleFilterParams = ref(null);
- const tabEditViewComplexFilterParams = ref(null);
- const openTabViewModal = ref(false);
- const tabFormViewType = ref('view');
- const tabFormViewRecordId = ref(null);
- const tabFormViewCurrentPage = ref(null);
- const tabFormViewCurrentIndex = ref(null);
- const tabFormViewTotalRecords = ref(null);
- const tabFormViewTaskInfoId = ref(null);
- const tabFormViewWorkflowType = ref(null);
- const tabFormViewSortStr = ref(null);
- const tabFormViewSimpleFilterParams = ref(null);
- const tabFormViewComplexFilterParams = ref(null);
- const emits = defineEmits(['update:open']);
- watch([openTabEditModal, openTabViewModal], (newValues, oldValues) => {
- console.log('First name or last name changed.');
- console.log('New values:', newValues);
- console.log('Old values:', oldValues);
- if(newValues[0] == false && newValues[1] == false){
- // emits('update:open', false);
- triggerRefresh();
- }
- });
- const triggerRefresh = () => {
- const event = new CustomEvent('refreshCurdData');
- window.dispatchEvent(event);
- };
- onMounted(() => {
- if(props.open == false){
- openTabEditModal.value = false;
- openTabViewModal.value = false;
- return;
- }
- mCurdWindowNo.value = props.curdWindowNo;
- mTabIndex.value = props.tabIndex;
- // 窗口类型
- // Edit:编辑界面,可选项如下(create:创建数据,edit:编辑数据,editRestore:恢复数据)
- // View:表单界面,可选项如下(view:视图数据,viewRestore:恢复数据)
- if(props.viewType == 'create' || props.viewType == 'edit' || props.viewType == 'editRestore'){
-
- openTabEditView({
- type: props.viewType,
- windowNo: props.curdWindowNo,
- tabIndex: props.tabIndex,
- modelDataId: props.modelDataId,
- currentPage: props.currentPage,
- currentIndex: props.currentIndex,
- totalRecords: props.totalRecords,
- uuid: props.uuid,
- isRestoreData: props.isRestoreData,
- taskInfoId: props.taskInfoId,
- workflowType: props.workflowType,
- sortStr: props.sortStr,
- simpleFilterParams: props.simpleFilterParams,
- complexFilterParams: props.complexFilterParams,
- });
- }else if(props.viewType == 'view' || props.viewType == 'viewRestore'){
- openTabFormView({
- type: props.viewType,
- windowNo: props.curdWindowNo,
- tabIndex: props.tabIndex,
- modelDataId: props.modelDataId,
- currentPage: props.currentPage,
- currentIndex: props.currentIndex,
- totalRecords: props.totalRecords,
- uuid: props.uuid,
- isRestoreData: props.isRestoreData,
- taskInfoId: props.taskInfoId,
- workflowType: props.workflowType,
- sortStr: props.sortStr,
- simpleFilterParams: props.simpleFilterParams,
- complexFilterParams: props.complexFilterParams,
- });
- }
- });
- /**
- * 打开页签视图模式
- * @param param 信息
- * 属性1: type: 类型,
- * 属性1: windowNo: CURD窗口编号,
- * 属性2: tabIndex: CURD页签编号,
- * 属性3: modelDataId: 数据记录id,
- * 属性4: currentPage: 当前记录所在的页码,
- * 属性5: currentIndex: 当前记录的排序,
- * 属性6: totalRecords: 记录的总数量,
- * 属性7: uuid: 窗口唯一Id,
- */
- const openTabFormView = function (param) {
- console.log('openTabFormView', param);
- tabFormViewType.value = param.type;
- mCurdWindowNo.value = param.windowNo;
- mTabIndex.value = param.tabIndex;
- tabFormViewRecordId.value = param.modelDataId;
- tabFormViewCurrentPage.value = param.currentPage;
- tabFormViewCurrentIndex.value = param.currentIndex;
- tabFormViewTotalRecords.value = param.totalRecords;
- tabFormViewSortStr.value = param.sortStr;
- tabFormViewSimpleFilterParams.value = param.simpleFilterParams;
- tabFormViewComplexFilterParams.value = param.complexFilterParams;
- openTabEditModal.value = false;
- openTabViewModal.value = true;
- };
- /**
- * 打开页签编辑模式
- * @param param 信息
- * 属性1: type: 类型,
- * 属性1: windowNo: CURD窗口编号,
- * 属性2: tabIndex: CURD页签编号,
- * 属性3: modelDataId: 数据记录id,
- * 属性4: currentPage: 当前记录所在的页码,
- * 属性5: currentIndex: 当前记录的排序,
- * 属性6: totalRecords: 记录的总数量,
- * 属性7: uuid: 窗口唯一Id,
- */
- const openTabEditView = function (param) {
- tabEditViewType.value = param.type;
- mCurdWindowNo.value = param.windowNo;
- mTabIndex.value = param.tabIndex;
- tabEditViewRecordId.value = param.modelDataId;
- tabEditViewCurrentPage.value = param.currentPage;
- tabEditViewCurrentIndex.value = param.currentIndex;
- tabEditViewTotalRecords.value = param.totalRecords;
- tabEditViewIsRestoreData.value = param.isRestoreData;
- tabEditViewSortStr.value = param.sortStr;
- tabEditViewSimpleFilterParams.value = param.simpleFilterParams;
- tabEditViewComplexFilterParams.value = param.complexFilterParams;
- openTabViewModal.value = false;
- openTabEditModal.value = true;
- };
- </script>
|