Ver Fonte

修改OneToOne视图界面。

YangZhiJie há 1 ano atrás
pai
commit
bcf282a3b9

+ 144 - 93
src/window1/tabFormView/SubOneToOneTabView.vue

@@ -1,19 +1,24 @@
 <template>
 <template>
+  <a-page-header
+    :title="Language.getNameTrl($i18n.locale, tab)"
+    style="border-bottom: 1px solid rgb(235, 237, 240); padding: 0px;"
+  />
+
   <div class="m-row clearfix">
   <div class="m-row clearfix">
     <div>
     <div>
       <div
       <div
+        v-if="tabFormFields && mModelData"
         :class="{
         :class="{
           'form-inline': tab.tabFormView.multipleColumn,
           'form-inline': tab.tabFormView.multipleColumn,
           'form-horizontal': !tab.tabFormView.multipleColumn,
           'form-horizontal': !tab.tabFormView.multipleColumn,
         }"
         }"
       >
       >
         <template
         <template
-          v-for="fieldItem in tabFormFields"
-          :key="
+          v-for="fieldItem in tabFormFields" :key="
             'FieldEditView_' +
             'FieldEditView_' +
               windowNo +
               windowNo +
               '_' +
               '_' +
-              tabIndex +
+              tab.tabIndex +
               '_' +
               '_' +
               fieldItem.fieldName +
               fieldItem.fieldName +
               '_' +
               '_' +
@@ -21,15 +26,9 @@
           "
           "
         >
         >
           <FieldEditView
           <FieldEditView
-            ref="fieldItem1"
-            :class-name="tab.tabDataSource.className"
-            :field="fieldItem"
-            :model-data="modelData"
-            :window-no="windowNo"
-            :tab-index="tabIndex"
-            :js-url="jsUrl"
-            :is-chinese-english="curdWindow.isChineseEnglish"
-            :multiple-column="tab.tabFormView.multipleColumn"
+            ref="fieldItem1" :class-name="tab.tabDataSource.className" :field="fieldItem"
+            :model-data="mModelData" :window-no="windowNo" :tab-index="tab.tabIndex" :js-url="jsUrl"
+            :is-chinese-english="curdWindow.isChineseEnglish" :multiple-column="tab.tabFormView.multipleColumn"
             @execute-callout="executeCallout(fieldItem)"
             @execute-callout="executeCallout(fieldItem)"
           />
           />
         </template>
         </template>
@@ -38,106 +37,158 @@
   </div>
   </div>
 </template>
 </template>
 
 
-<script>
+<script setup>
 import Common from '../../common/Common';
 import Common from '../../common/Common';
 import FieldEditView from './TabFormFieldView.vue';
 import FieldEditView from './TabFormFieldView.vue';
 import WindowClientUtil from '../../resource/dictionary/WindowClientUtil.js';
 import WindowClientUtil from '../../resource/dictionary/WindowClientUtil.js';
+import Language from '../../common/Language.js';
+import ProcessReportResource from '../../api/dic/ProcessReportResource.js';
+import { ref, reactive, defineEmits, defineProps, watch } from 'vue';
+import { debounce } from 'lodash';
 
 
-export default {
-  components: {
-    FieldEditView,
-  },
 
 
-  props: {
-    subOneToOneTab: {
-      type: Object,
-      default: null,
-    },
-    tab: {
-      type: Object,
-      default: null,
+// 接受父组件传递的数据
+const props = defineProps({
+  tab: {
+    type: Object,
+    default: ()=>{
+      return {};
     },
     },
-    modelData: {
-      type: Object,
-      default: null,
+  },
+  parentModelData: {
+    type: Object,
+    default: ()=>{
+      return {};
     },
     },
-    curdWindow: {
-      type: Object,
-      default: null,
+  },
+  curdWindow: {
+    type: Object,
+    default: ()=>{
+      return {};
     },
     },
+  },
 
 
-    windowNo: {
-      type: String,
-      default: null,
-    },
-    tabIndex: {
-      type: Number,
-      default: null,
-    },
+  windowNo: {
+    type: String,
+    default: null,
+  },
 
 
-    jsUrl: {
-      type: String,
-      default: null,
-    },
-    isChineseEnglish: {
-      type: Boolean,
-      default: null,
-    },
+  jsUrl: {
+    type: String,
+    default: null,
+  },
+  
+  isChineseEnglish: {
+    type: Boolean,
+    default: false,
   },
   },
+});
 
 
-  emits: ['executeCallout'],
+const mModelData = ref({});
+const tabFormFields = ref([]);
 
 
-  data() {
-    return {
-      oneToOneModelData: [],
-    };
-  },
-  watch: {
-    subOneToOneTab: {
-      handler(newVal) {
-        if (newVal) {
-          this.tabFormFields = WindowClientUtil.getDetailField(newVal);
-          this.getOneToOneTabData(newVal.tabIndex);
-        }
-      },
-      immediate: true,
+const emits = defineEmits([]);
+
+
+
+/**
+ * 查询一对一页签数据
+ */
+const getOneToOneTabData = function () {
+  const params = {
+    windowNo: props.windowNo,
+    tabIndex: props.tab.tabIndex,
+    parentId: props.parentModelData == undefined ? undefined : props.parentModelData.id,
+  };
+  $.ajax({
+    url: Common.getApiURL('CurdWindowResource/oneToOneTabData'),
+    async: false,
+    dataType: 'json',
+    type: 'post',
+    data: JSON.stringify(params),
+    contentType: 'application/json',
+    beforeSend: function (request) {
+      Common.addTokenToRequest(request);
     },
     },
-  },
+    success: function (data) {
+      mModelData.value = data;
+    },
+    error: function (XMLHttpRequest, textStatus, errorThrown) {
+      Common.processException(XMLHttpRequest, textStatus, errorThrown);
+    },
+  });
+};
 
 
-  methods: {
-    // 查询一对一页签数据
-    getOneToOneTabData: function (tabIndex) {
-      const _self = this;
-      const params = {
-        tabIndex,
-        windowNo: this.windowNo,
-        parentId: _self.modelData == undefined ? undefined : _self.modelData.id,
-      };
-      $.ajax({
-        url: Common.getApiURL('CurdWindowResource/oneToOneTabData'),
-        async: false,
-        dataType: 'json',
-        type: 'post',
-        data: JSON.stringify(params),
-        contentType: 'application/json',
-        beforeSend: function (request) {
-          Common.addTokenToRequest(request);
-        },
-        success: function (data) {
-          _self.oneToOneModelData = data;
+
+/**
+ * 执行Callout
+ */
+const executeCallout = function (fieldItem) {
+  if (fieldItem.calloutProcessReportNo != null) {
+    callout(fieldItem.calloutProcessReportNo);
+  }
+};
+
+/**
+ * callout
+ * @param  {[type]} calloutProcessReportNo [description]
+ * @return {[type]}                  [description]
+ */
+const callout = function (calloutProcessReportNo) {
+  // 查询流程和报表的定义
+  ProcessReportResource.uniqueByNo(calloutProcessReportNo).then(
+    successData => {
+      if (successData == null) {
+        return;
+      }
+
+      // 执行服务端的脚本
+      ProcessReportResource.runCallout(
+        calloutProcessReportNo,
+        mModelData.value,
+      ).then(
+        successData => {
+          if (successData && successData.modelData) {
+            mModelData.value = successData.modelData;
+          }
         },
         },
-        error: function (XMLHttpRequest, textStatus, errorThrown) {
-          Common.processException(XMLHttpRequest, textStatus, errorThrown);
+        errorData => {
+          Common.processException(errorData);
         },
         },
-      });
+      );
     },
     },
-
-    executeCallout(field) {
-      this.$emit('executeCallout', field);
+    errorData => {
+      Common.processException(errorData);
     },
     },
-  },
+  );
 };
 };
+
+/**
+ * 延迟获取页面的数据
+ */
+const debounceGetOneToOneTabData = debounce(() => {
+  getOneToOneTabData();
+}, 1000);
+
+
+watch(
+  () => [props.windowNo, props.tab, props.parentModelData],
+  (newValue, oldValue) => {
+    debounceGetOneToOneTabData();
+  },
+  { immediate: true },
+);
+
+watch(
+  () => props.tab, 
+  (newValue, oldValue) => {
+    tabFormFields.value = WindowClientUtil.getDetailField(newValue);
+    console.log(tabFormFields.value);
+  },
+  { immediate: true },
+);
+
+
 </script>
 </script>
 
 
-<style scoped>
-</style>
+<style scoped></style>

+ 14 - 9
src/window1/tabFormView/TabFormViewModal.vue

@@ -158,7 +158,7 @@
               tab.tabFormView.fieldGroups.length > 0
               tab.tabFormView.fieldGroups.length > 0
           " class="m-row clearfix"
           " class="m-row clearfix"
         >
         >
-          <ul id="myTabs" class="nav nav-tabs" role="tablist">
+          <!-- <ul id="myTabs" class="nav nav-tabs" role="tablist">
             <li
             <li
               v-for="(fieldGroup, fieldGroupIndex) in tab.tabFormView.fieldGroups" :key="fieldGroup.groupName"
               v-for="(fieldGroup, fieldGroupIndex) in tab.tabFormView.fieldGroups" :key="fieldGroup.groupName"
               role="presentation" :class="{ active: selectedTabIndex == fieldGroupIndex }"
               role="presentation" :class="{ active: selectedTabIndex == fieldGroupIndex }"
@@ -168,14 +168,19 @@
                 {{ Language.getGroupNameTrl($i18n.locale, fieldGroup) }}
                 {{ Language.getGroupNameTrl($i18n.locale, fieldGroup) }}
               </a>
               </a>
             </li>
             </li>
-          </ul>
+          </ul> -->
 
 
           <div id="myTabContent" class="tab-content">
           <div id="myTabContent" class="tab-content">
             <div
             <div
-              v-for="(fieldGroup, fieldGroupIndex) in tab.tabFormView.fieldGroups"
-              v-show="selectedTabIndex == fieldGroupIndex" id="home" :key="fieldGroup.groupName" role="tabpanel"
+              v-for="(fieldGroup) in tab.tabFormView.fieldGroups"
+              id="home" :key="fieldGroup.groupName" role="tabpanel"
               class="tab-pane fade active in" aria-labelledby="home-tab"
               class="tab-pane fade active in" aria-labelledby="home-tab"
             >
             >
+              <a-page-header
+                :title="Language.getGroupNameTrl($i18n.locale, fieldGroup)"
+                style="border-bottom: 1px solid rgb(235, 237, 240); padding: 0px;"
+              />
+  
               <div v-if="fieldGroup.show">
               <div v-if="fieldGroup.show">
                 <div
                 <div
                   :class="{
                   :class="{
@@ -210,16 +215,15 @@
         <!-- eslint-disable-next-line -->
         <!-- eslint-disable-next-line -->
         <div v-html="footerHtml" />
         <div v-html="footerHtml" />
 
 
-        <template v-if="modelData && tab.subOneToOneTabs && tab.subOneToOneTabs.length">
-          <div v-for="oneToOneTab in tab.subOneToOneTabs " :key="'SubOneToOneTabGridEdit-' + windowNo + '-' + tabIndex + '-' + modelData.id + '-oneToOneTab-' + oneToOneTab.tabIndex">
+        <template v-if="modelData && tab.subOneToOneTabs && tab.subOneToOneTabs.length > 0">
+          <div v-for="oneToOneTab in tab.subOneToOneTabs " :key="'SubOneToOneTabView-' + windowNo + '-' + tabIndex + '-' + oneToOneTab.tabIndex + '-' + modelData.id">
             <SubOneToOneTabView
             <SubOneToOneTabView
-              :sub-one-to-one-tab="oneToOneTab" :tab="tab" :model-data="modelData"
+              :tab="oneToOneTab" 
+              :parent-model-data="modelData"
               :window-no="windowNo"
               :window-no="windowNo"
-              :tab-index="tabIndex"
               :js-url="jsUrl"
               :js-url="jsUrl"
               :curd-window="curdWindow"
               :curd-window="curdWindow"
               :is-chinese-english="curdWindow.isChineseEnglish"
               :is-chinese-english="curdWindow.isChineseEnglish"
-              @execute-callout="executeCallout(fieldItem)"
             />
             />
           </div>
           </div>
         </template>
         </template>
@@ -403,6 +407,7 @@ import { CaretRightOutlined, CaretLeftOutlined, SmallDashOutlined, ExclamationCi
 import { createVNode } from 'vue';
 import { createVNode } from 'vue';
 import { Modal } from 'ant-design-vue';
 import { Modal } from 'ant-design-vue';
 import SubOneToOneTabView from './SubOneToOneTabView.vue';
 import SubOneToOneTabView from './SubOneToOneTabView.vue';
+
 export default {
 export default {
 
 
   components: {
   components: {

+ 0 - 1
src/window1/tabGridView/NewTabButton.vue

@@ -1,6 +1,5 @@
 <template>
 <template>
   <div class="button_list">
   <div class="button_list">
-    <div v-if="leftTabButton.length === 0" />
     <a-space v-if="leftTabButton && leftTabButton.length" size="small">
     <a-space v-if="leftTabButton && leftTabButton.length" size="small">
       <template v-for="(item, index) in leftTabButton" :key="index">
       <template v-for="(item, index) in leftTabButton" :key="index">
         <a-button
         <a-button

+ 3 - 0
src/window1/tabGridView/TabGridEdit.vue

@@ -674,6 +674,9 @@ export default {
         this.tabIndex,
         this.tabIndex,
         this.tabGridFields,
         this.tabGridFields,
       );
       );
+
+      console.log(_self.tabGridFields);
+
       if (
       if (
         _self.tab.tabDataSource.tabDataSourceGroupDtos &&
         _self.tab.tabDataSource.tabDataSourceGroupDtos &&
         _self.tab.tabDataSource.tabDataSourceGroupDtos.length
         _self.tab.tabDataSource.tabDataSourceGroupDtos.length