Forráskód Böngészése

Merge branch 'master' of https://a.leanwo.com:3000/prodog-client-2023/client-base-v4

# Conflicts:
#	src/window1/tabGridView/NewTabButton.vue
liuyanpeng 1 éve
szülő
commit
d578909983

+ 72 - 15
src/window1/tabGridView/GridBody.vue

@@ -98,6 +98,40 @@
       </td>
     </template>
   </tr>
+  <Modal v-model:show="modal" :full="true">
+    <ProcessReportResultPreview
+      v-if="
+        processReportResult != null &&
+          (processReportResult.reportResults != null ||
+            processReportResult.processResult != null)
+      "
+      :process-report-result="processReportResult"
+      :pdf-only="false"
+      :excel-only="false"
+    />
+    <template #header>
+      {{ $t("lang.tabButton.executeResult") }}
+    </template>
+  </Modal>
+  <Modal
+    v-model:show="titleModal"
+    :show-canel-button="false"
+    :show-ok-button="false"
+  >
+    <template #header>
+      {{ tabButtonModel.tipsTitle }}
+    </template>
+    {{ tabButtonModel.tipsContent }}
+    <template #footer>      
+      <button type="button" class="btn btn-default" @click="titleModalClose">
+        {{ $t("lang.tabButton.cancel") }}
+      </button>
+      <button type="primary" class="btn btn-default" @click="executeProcess">
+        确认
+      </button>
+    </template>
+  </Modal>
+  <component :is="modal1Component" v-model:open="modal1Open" />
   <component :is="modal1Component" v-model:open="modal1Open" :model-data="modelData" />
 </template>
 
@@ -182,8 +216,18 @@ export default {
       type: String,
       default: null,
     },    
+    simpleFilterParams: {
+      type: String,
+      default: null,
+    },
+    complexFilterParams: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
   },
-  emits: ['deleteRecord', 'editRecord', 'readRecord', 'clickModelData', 'executeCallout', 'valueChanged'],
+  emits: ['deleteRecord', 'editRecord', 'readRecord', 'clickModelData', 'executeCallout', 'valueChanged', 'refreshDatas'],
 
 
   data: function () {
@@ -194,6 +238,10 @@ export default {
       Language: Language,
       modal1Open: false,
       modal1Component: null,
+      processReportResult: {},
+      modal: false,
+      titleModal: false,
+      tabButtonModel:{},
     };
   },
   computed: {
@@ -326,6 +374,9 @@ export default {
     deleteRecord: function () {
       this.$emit('deleteRecord');
     },
+    refreshDatas: function(){
+      this.$emit('refreshDatas');
+    },
 
     buttonClick: function(){
       Notify.error('提示', '暂不支持该组件', false);
@@ -432,6 +483,7 @@ export default {
     //跳转或执行流程
     execute: function (tabButton) {
       var _self = this;
+      _self.tabButtonModel = tabButton;
       if (tabButton.customerWindowNo != undefined && tabButton.customerWindowNo != '') {
         CustomerWindowResource.uniqueByNo(tabButton.customerWindowNo).then(
           successData => {
@@ -454,7 +506,11 @@ export default {
         // 判断流程报表是否有参数
         // 如果有参数则直接跳转到流程和报表的界面。
         if (tabButton.routerRedirect == undefined || tabButton.routerRedirect == false) {
-          _self.executeProcess(tabButton);
+          if(tabButton.tipsTitle == undefined || tabButton.tipsTitle.length == 0){
+            _self.executeProcess();
+          }else{
+            _self.titleModal = true;
+          }
         } else {
           this.$router.push({
             path: '/desktop/process-report/' + tabButton.processReportNo,
@@ -514,7 +570,7 @@ export default {
             Common.processException(errorData);
           },
         );
-      }
+      }      
     },
     // 切换到Form表单的路由
     switchFormRoute: function (tabButton) {
@@ -522,7 +578,6 @@ export default {
       var routeDate = {
         path: tabButton.customerWindowRouteUrl,
         params: {
-          processReportId: tabButton.processReportId,
           modelData: this.modelData,
         },
       };
@@ -533,13 +588,13 @@ export default {
       }
 
       const frameUrl = Common.getRedirectUrl(
-        '#' + routeDate.path + '?processReportId=' + tabButton.processReportId,
+        '#' + routeDate.path,
       );
 
       // 供子页面iframe调用,修改modelData,(举例:生单界面修改参数)。
-      window.modelDataChanged = this.modelDataChanged;
+      // window.modelDataChanged = this.modelDataChanged;
 
-      window.getModelData = this.getModelData;
+      // window.getModelData = this.getModelData;
       let modelData = JSON.stringify(this.modelData);
       console.log(modelData);
       localStorage.setItem(_self.uuid + '#GenerateDocumentTool', modelData);
@@ -552,15 +607,12 @@ export default {
       // window.open(frameUrl);
     },
     // 执行流程
-    executeProcess: function (tabButton) {
+    executeProcess: function () {
       var _self = this;
       var ids = [_self.modelData.id];
-      _self.loading=true;
-
-      ProcessReportResource.runProcessByIds(tabButton.processReportNo, ids).then(
+      ProcessReportResource.runProcessByIds(_self.tabButtonModel.processReportNo, ids).then(
         successData => {
           _self.modal = true;
-          _self.loading=false;
           _self.processReportResult = successData;
 
           if (
@@ -580,14 +632,14 @@ export default {
               }
             });
           }
-
-          _self.$emit('processExecuteFinish');
+          _self.titleModal = false;
         },
         errorData => {
-          _self.loading=false;
+          _self.titleModal = false;
           Common.processException(errorData);
         },
       );
+      _self.refreshDatas();
       // }
     },
     /**
@@ -651,6 +703,11 @@ export default {
         console.log(_self.modal1Component);
       }
     },
+    //关闭表头按钮提示框
+    titleModalClose: function (){
+      var _self = this;
+      _self.titleModal = false;
+    },
   },
 };
 </script>

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

@@ -22,18 +22,21 @@
         <a-button
           v-else-if="item.action === 'RUN_PROCESS_REPORT'"
           :icon="h(ControlTwoTone)"
+          @click="execute(item)"
         >
           {{ item.name }}
         </a-button>
         <a-button
           v-else-if="item.action === 'OPEN_CUSTOMER_WINDOW'"
           :icon="h(BookTwoTone)"
+          @click="execute(item)"
         >
           {{ item.name }}
         </a-button>
         <a-button
           v-else-if="item.action === 'OPEN_HTML_WINDOW'"
           :icon="h(ContainerTwoTone)"
+          @click="execute(item)"
         >
           {{ item.name }}
         </a-button>
@@ -131,6 +134,21 @@
     </a-space>
     <div v-else />
   </div>
+  <Modal v-model:show="modal" :full="true">
+    <ProcessReportResultPreview
+      v-if="
+        processReportResult != null &&
+          (processReportResult.reportResults != null ||
+            processReportResult.processResult != null)
+      "
+      :process-report-result="processReportResult"
+      :pdf-only="false"
+      :excel-only="false"
+    />
+    <template #header>
+      {{ $t("lang.tabButton.executeResult") }}
+    </template>
+  </Modal>
 
   <Modal
     v-model:show="notificationModal"
@@ -142,7 +160,7 @@
     </template>
     <NotificationPanel ref="notificationPanel" />
     <template #footer>
-      <button type="button" class="btn btn-default" @click="sendNotification">
+      <button type="button" class="btn btn-default" @click="executeProcess">
         {{ $t("lang.tabButton.send") }}
       </button>
       <button type="button" class="btn btn-default" @click="cancelNotification">
@@ -172,6 +190,9 @@ import NotificationPanel from '../../customer/NotificationPanel.vue';
 import dayjs from 'dayjs';
 import GridColumnDefUtil from '../tabGridView/GridColumnDef.js';
 import GridColumnDef from '../tabGridView/GridColumnDef.vue';
+import CustomerWindowResource from '../../api/dic/CustomerWindowResource.js';
+import HtmlWindowResource from '../../api/dic/HtmlWindowResource.js';
+import ProcessReportResource from '../../api/dic/ProcessReportResource.js';
 
 import { Spin as ASpin, Empty as AEmpty } from 'ant-design-vue';
 import { CssUtil } from 'pc-component-v3';
@@ -253,6 +274,11 @@ const tabButtons = ref([]);
 const leftTabButton = ref([]);
 const rightTabButton = ref([]);
 const notificationModal = ref(false);
+const processReportResult = ref(null);
+const modal = ref(false);
+//表头按钮提示模态框
+const titleModal = ref(false);
+const tabButtonModel = ref(null);
 const notificationPanel = ref(null);
 // 模态框的打开状态
 const modal1Open = ref(false);
@@ -566,6 +592,211 @@ const openRemoteComponentModule = async function (tabButton) {
     console.log(modal1Component.value);
   }
 };
+//跳转或执行流程
+const execute = async function (tabButton) {
+  tabButtonModel.value = tabButton;
+  if (tabButton.customerWindowNo != undefined && tabButton.customerWindowNo != '') {
+    CustomerWindowResource.uniqueByNo(tabButton.customerWindowNo).then(
+      successData => {
+        tabButton.customerWindowRouteUrl = successData.routeUrl;
+        if(tabButton.customerWindowNo == '20221101_151823'){
+          localStorage.setItem('AssetInstance_ComplexFilterParams',JSON.stringify(props.complexFilterParams));
+          localStorage.setItem('AssetInstance_SimpleFilterParams', props.simpleFilterParams);
+        }
+        //跳转到tabButton.routeUrl
+        if (props.viewType == 'Form' || props.viewType == 'EditForm') {
+          switchFormRoute(tabButton);
+        } else if (props.viewType == 'Grid') {
+          switchFormRoute(tabButton);
+        }
+      },
+      errorData => {
+        Common.processException(errorData);
+      },
+    );
+  } else if (
+    tabButton.processReportNo != undefined &&
+        tabButton.processReportNo != ''
+  ) {        
+    // 判断流程报表是否有参数
+    // 如果有参数则直接跳转到流程和报表的界面。
+    if (tabButton.routerRedirect == undefined || tabButton.routerRedirect == false) {
+      titleModal.value = true;      
+      if(tabButton.tipsTitle == undefined || tabButton.tipsTitle.length == 0){
+        executeProcess();
+      }else{
+        titleModal.value = true;
+      }
+    } else {
+      this.$router.push({
+        path: '/desktop/process-report/' + tabButton.processReportNo,
+      });
+    }
+  } else if (tabButton.htmlWindowNo != undefined) {
+    HtmlWindowResource.uniqueByNo(tabButton.htmlWindowNo).then(
+      htmlWindowDto => {
+        if (htmlWindowDto != undefined) {
+          var htmlWindowUrl = htmlWindowDto.htmlFileName;
+          var autoCloseInterval = htmlWindowDto.autoCloseInterval;
+          var regExp = new RegExp('[{].*?[}]', 'g');
+          var result = htmlWindowUrl.match(regExp);
+          if (htmlWindowUrl != undefined && htmlWindowUrl != '') {
+            for (var index = 0, len = result.length; index < len; index++) {
+              var tempResult = result[index];
+              console.log('{' + tempResult + '}匹配');
+              if (tempResult == '{URL}') {
+                htmlWindowUrl = htmlWindowUrl.replace(
+                  '{URL}',
+                  Common.getHostPageBaseURL(),
+                );
+              } else if (tempResult == '{RecordIds}') {
+                if (props.viewType == 'Grid') {
+                  var recordIds = '';
+                  if (props.modelDatas && props.modelDatas.length > 0) {
+                    props.modelDatas.forEach(function (item) {
+                      if (item.select) {
+                        recordIds += item.id + ',';
+                      }
+                    });
+                  }
+                  if (recordIds != null && recordIds.length > 0) {
+                    recordIds = recordIds.substring(0, recordIds.length - 1);
+                  } else {
+                    Notify.error(proxy.$t('lang.Notify.error'), proxy.$t('lang.tabButton.describe3'), true);
+                    return;
+                  }
+                  htmlWindowUrl = htmlWindowUrl.replace('{RecordIds}', recordIds);
+                } else {
+                  var recordId = props.modelData.id;
+                  htmlWindowUrl = htmlWindowUrl.replace('{RecordIds}', recordId);
+                }
+              } else if (tempResult == '{Token}') {
+                htmlWindowUrl = htmlWindowUrl.replace('{Token}', Common.getToken());
+              } else {
+                if (props.selectedModelDatas.length == 0) {
+                  Notify.error(proxy.$t('lang.Notify.error'), proxy.$t('lang.tabButton.describe3'), true);
+                  return;
+                } else if (props.selectedModelDatas.length > 1) {
+                  Notify.error(proxy.$t('lang.Notify.error'), proxy.$t('lang.tabButton.describe2'), true);
+                  return;
+                }
+                var tempResult1 = tempResult.replace('{', '').replace('}', '');
+                htmlWindowUrl = htmlWindowUrl.replace(
+                  tempResult,
+                  props.getFirstSelectModelDataFieldValue(tempResult1),
+                );
+              }
+            }
+
+            var openWindow = window.open(htmlWindowUrl);
+
+            // 自动关闭
+            if (autoCloseInterval != undefined) {
+              setTimeout(function () {
+                openWindow.close();
+                openWindow = undefined;
+              }, autoCloseInterval * 1000);
+            }
+          }
+        }
+      },
+      errorData => {
+        Common.processException(errorData);
+      },
+    );
+  }
+};
+// 切换到Form表单的路由
+const switchFormRoute = async function (tabButton) {
+  var recordIds = '';
+  if (props.modelDatas && props.modelDatas.length > 0) {
+    props.modelDatas.forEach(function (item) {
+      if (item.select) {
+        recordIds += item.id + ',';
+      }
+    });
+  }
+  var routeDate = {
+    path: tabButton.customerWindowRouteUrl,
+    params: {
+      recordIds: recordIds,
+    },
+  };
+  // 请勿修改,会影响生单的功能
+  var uuid = props.uuid;
+  if (uuid != undefined) {
+    routeDate.path = routeDate.path + '/' + uuid;
+  }
+
+  const frameUrl = Common.getRedirectUrl(
+    '#' + routeDate.path,
+  );
+
+  // 供子页面iframe调用,修改modelData,(举例:生单界面修改参数)。
+  // window.modelDataChanged = modelDataChanged;
+
+  // window.getModelData = this.getModelData;
+  // let modelData1 = JSON.stringify(modelData);
+  // console.log(modelData1);
+  // localStorage.setItem(props.uuid + '#GenerateDocumentTool', modelData1);
+
+  var iWidth = 1280;//弹出窗口的宽度;
+  var iHeight = 720; //弹出窗口的高度;
+  var iTop = (window.screen.availHeight-30-iHeight)/2;//获得窗口的垂直位置;
+  var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
+  window.open(frameUrl,'_blank','height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
+  // window.open(frameUrl);
+};
+// 执行流程
+const executeProcess = async function () {
+  var ids = [];
+  if (props.modelDatas) {
+    props.modelDatas.forEach(function (modelData) {
+      if (modelData.select == true) {
+        ids.push(modelData.id);
+      }
+    });
+  } else if (props.modelData) {
+    ids.push(props.modelData.id);
+  }
+  // props.loading=true;
+
+  ProcessReportResource.runProcessByIds(tabButtonModel.value.processReportNo, ids).then(
+    successData => {
+      modal.value = true;
+      // _self.loading=false;
+      processReportResult.value = successData;
+
+      if (
+        processReportResult.value.reportResults != undefined &&
+        processReportResult.value.reportResults.length > 0
+      ) {
+        processReportResult.value.reportResults.forEach(function (item, index) {
+          if(item.reportDefinitionType!=='ExcelReport'){
+            item.previewIndex=1;
+          }else{
+            item.previewIndex=2;
+          }
+          if (index == 0) {
+            item.showPreview=true;
+          } else {
+            item.showPreview=false;
+          }
+        });
+      }
+      titleModal.value = false;
+    },
+    errorData => {
+      titleModal.value = false;
+      Common.processException(errorData);
+    },
+  );
+  // }
+};
+//关闭表头按钮提示框
+const titleModalClose = async function (){
+  titleModal.value = false;
+};
 </script>
 
 <style scoped>

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

@@ -74,11 +74,12 @@
                       " :is-show-edit="!tab.tabDataSource.readOnly" :tab-grid-fields="tabGridFields"
                       :tab-grid-title-fields="tabGridTitleFields"
                       :model-data="modelData" 
-                      
+                      :simple-filter-params="searchText"
+                      :complex-filter-params="complexFilterParams"
                       :class-name="tab.tabDataSource.className"
                       :scroll-object="scrollObject" :js-url="jsUrl" @delete-record="deleteRecord(modelData, true)"
                       @edit-record="editRecord(modelData, index)" @click-model-data="clickModelData(modelData)"
-                      @read-record="readRecord(modelData, index)"
+                      @read-record="readRecord(modelData, index)" @refresh-datas="refreshDatas"
                       @value-changed="valueChanged($event, modelData, index)" @execute-callout="
                         executeCallout($event, modelData, index)
                       "