Przeglądaj źródła

UPS功能迁移:SHA-1: 0f2d765d8c07646e609ada2c1c503cd7965db795

* 1. 保存(新增、更新)以后,调用save(verifyOptionalConditions = true),此时对必要条件进行校验,然后对可选条件进行校验,如果全部校验通过,那么保存完成。
如果必要条件校验失败,那么返回校验类型(强制校验)、校验结果、
如果可选条件校验失败,那么返回校验类型(可选校验)、校验结果

2. 保存(新增、更新)以后,调用save(verifyOptionalConditions = true),此时对必要条件进行校验,然后对可选条件进行校验,如果全部校验通过,那么保存完成。如果可选条件校验失败,依然保存。同时做日志记录,记录操作人、操作内容、操作时间。
如果必要条件校验失败,那么返回校验类型(强制校验)、校验结果
如果可选条件校验失败,那么返回校验类型(可选校验)、校验结果
YangZhiJie 1 rok temu
rodzic
commit
37730166ca

+ 49 - 2
src/window/tabFormView/TabFormEdit.vue

@@ -254,6 +254,29 @@
       <template #header>{{ $t("lang.tabFormEdit.describe5") }}</template>
       <div>{{ $t("lang.tabFormEdit.describe6") }}</div>
     </Modal>
+
+    
+
+    <Modal v-model:show="verifyResultModal" @ok="saveTabData(verifyResultCommand, false)"
+      @cancel="verifyResultModal = false">
+      <template #header>{{ $t("lang.tabFormEdit.verifyResult") }}</template>
+      <div v-if="verifyResults != null">
+        <template v-for="verifyResult in verifyResults">
+          <div v-if="verifyResult && verifyResult.code != 0" class="alert "
+            :class="{ 'alert-warning': verifyResult.verifyType == 'Optional', 'alert-danger': verifyResult.verifyType == 'Mandatory' }"
+            style="white-space: pre-wrap"
+            >
+            {{ verifyResult.message }}
+          </div>
+
+          <p class="bg-danger" style="font-size: medium; padding: 2rem;">
+            {{ $t("lang.tabFormEdit.submitConfirm") }}
+          </p>
+        </template>
+      </div>
+    </Modal>
+
+
     <Loading v-if="loading" />
   </div>
 </template>
@@ -363,6 +386,10 @@ export default {
       modal2: false,
       modal3: false,
       refreshFlag: false,
+      
+      verifyResultModal: false, // 校验结果模态框
+      verifyResults: null, // 校验结果
+      verifyResultCommand: null,
     };
   },
 
@@ -1286,7 +1313,7 @@ export default {
     },
 
     // 保存
-    saveTabData: function (command) {
+    saveTabData: function (command, verifyOptionalConditions) {
       var _self = this;
       var fieldWidgets1 = _self.$refs.fieldItem1;
       var fieldWidgets2 = _self.$refs.fieldItem2;
@@ -1358,14 +1385,34 @@ export default {
         var tabSaveData = {
           attributeValueDtos: attributeValueDtos,
           persistenceData: _self.modelData,
+          verifyOptionalConditions: (verifyOptionalConditions == null) ? true : verifyOptionalConditions,
         };
 
         _self.loading = true;
         WindowServerUtil.saveTabData(
           tabSaveData,
-          function (id) {
+          function (response) {
             _self.loading = false;
+            if (response.errorCode < 0) {
+              // 保存异常
+              Notify.error('Error', response.errorMessage, false);
+              return;
+            }
 
+            const tabDataSaveResponse = response.data;
+
+            if (response.errorCode == 1) {
+              // 校验错误
+              console.log(tabDataSaveResponse.verifyResults);
+              _self.verifyResults = tabDataSaveResponse.verifyResults;
+              _self.verifyResultModal = true;
+              _self.verifyResultCommand = command;
+              return;
+            }
+
+
+            const id = tabDataSaveResponse.recordId;
+            
             // 自动关闭
             var saveClose = Common.getRouteParam('saveClose');
             if (saveClose == 'true') {

+ 59 - 3
src/window/tabGridView/TabGridEdit.vue

@@ -248,6 +248,30 @@
         存在草稿,是否恢复数据?
       </div>
     </Modal>
+
+    
+    
+    <Modal v-model:show="verifyResultModal" @ok="saveTabData(verifyModelData, verifyIndex, false)" @cancel="verifyResultModal=false">
+      <template #header>{{ $t("lang.tabFormEdit.verifyResult") }}</template>
+      <div v-if="verifyResults != null">
+
+        <template v-for="verifyResult in verifyResults">
+          <div v-if="verifyResult && verifyResult.code != 0" class="alert "
+            :class="{ 'alert-warning': verifyResult.verifyType == 'Optional', 'alert-danger': verifyResult.verifyType == 'Mandatory' }"
+            style="white-space: pre-wrap">
+            {{ verifyResult.message }}
+          </div>
+
+          <p class="bg-danger" style="font-size: medium; padding: 2rem;">
+            {{ $t("lang.tabFormEdit.submitConfirm") }}
+          </p>
+
+        </template>
+
+      </div>
+    </Modal>
+
+
     <Loading v-if="loading" />
   </div>
 </template>
@@ -352,6 +376,13 @@ export default {
       modal2: false,
 
       searchText: '', // 简单过滤条件
+
+            
+      verifyResultModal: false, // 校验结果模态框
+      verifyResults: null,    // 校验结果
+      verifyModelData: null,  // 校验的数据
+      verifyIndex: null       // 校验的编号
+
     };
   },
   computed: {
@@ -998,7 +1029,7 @@ export default {
           if (!modelData.editMode) {
             modelData.editMode = true;
           } else {
-            this.saveTabData(modelData, index);
+            this.saveTabData(modelData, index, true);
           }
           modelData.changed = true;
           _self.dataChanged = true;
@@ -1524,7 +1555,7 @@ export default {
      * @param  {[type]} modelData [description]
      * @return {[type]}           [description]
      */
-    saveTabData: function (modelData, index) {
+    saveTabData: function (modelData, index, verifyOptionalConditions) {
       var _self = this;
 
       var promises = [];
@@ -1551,11 +1582,36 @@ export default {
         var tabSaveData = {
           attributeValueDtos: null,
           persistenceData: modelData,
+          verifyOptionalConditions: (verifyOptionalConditions == null) ? true: verifyOptionalConditions,
+
         };
         _self.loading=true;
         WindowServerUtil.saveTabData(
           tabSaveData,
-          function (id) {
+          function (response) {
+            if(response.errorCode < 0){
+              _self.loading=false;
+              // 保存异常
+              Notify.error('Error', response.errorMessage, false);
+              return;
+            }
+
+            const tabDataSaveResponse = response.data;
+
+            if(response.errorCode == 1){
+              _self.loading=false;
+              // 校验错误
+              _self.verifyModelData = modelData;
+              _self.verifyIndex = index;
+              _self.verifyResults = tabDataSaveResponse.verifyResults;
+              _self.verifyResultModal = true;
+              return;
+            }
+
+
+            const id = tabDataSaveResponse.recordId;
+
+
             var tabLoadParam = {
               windowNo: _self.windowNo,
               tabIndex: modelData.tabIndex,

+ 50 - 2
src/window1/tabFormEdit/TabFormEdit.vue

@@ -254,6 +254,29 @@
       <template #header>{{ $t("lang.tabFormEdit.describe5") }}</template>
       <div>{{ $t("lang.tabFormEdit.describe6") }}</div>
     </Modal>
+
+    
+
+    <Modal v-model:show="verifyResultModal" @ok="saveTabData(verifyResultCommand, false)"
+      @cancel="verifyResultModal = false">
+      <template #header>{{ $t("lang.tabFormEdit.verifyResult") }}</template>
+      <div v-if="verifyResults != null">
+        <template v-for="verifyResult in verifyResults">
+          <div v-if="verifyResult && verifyResult.code != 0" class="alert "
+            :class="{ 'alert-warning': verifyResult.verifyType == 'Optional', 'alert-danger': verifyResult.verifyType == 'Mandatory' }"
+            style="white-space: pre-wrap"
+            >
+            {{ verifyResult.message }}
+          </div>
+
+          <p class="bg-danger" style="font-size: medium; padding: 2rem;">
+            {{ $t("lang.tabFormEdit.submitConfirm") }}
+          </p>
+        </template>
+      </div>
+    </Modal>
+
+
     <Loading v-if="loading" />
   </div>
 </template>
@@ -363,6 +386,11 @@ export default {
       modal2: false,
       modal3: false,
       refreshFlag: false,
+
+      
+      verifyResultModal: false, // 校验结果模态框
+      verifyResults: null, // 校验结果
+      verifyResultCommand: null,
     };
   },
 
@@ -1284,7 +1312,7 @@ export default {
     },
 
     // 保存
-    saveTabData: function (command) {
+    saveTabData: function (command, verifyOptionalConditions) {
       var _self = this;
       var fieldWidgets1 = _self.$refs.fieldItem1;
       var fieldWidgets2 = _self.$refs.fieldItem2;
@@ -1356,14 +1384,34 @@ export default {
         var tabSaveData = {
           attributeValueDtos: attributeValueDtos,
           persistenceData: _self.modelData,
+          verifyOptionalConditions: (verifyOptionalConditions == null) ? true : verifyOptionalConditions,
         };
 
         _self.loading = true;
         WindowServerUtil.saveTabData(
           tabSaveData,
-          function (id) {
+          function (response) {
             _self.loading = false;
+            if (response.errorCode < 0) {
+              // 保存异常
+              Notify.error('Error', response.errorMessage, false);
+              return;
+            }
 
+            const tabDataSaveResponse = response.data;
+
+            if (response.errorCode == 1) {
+              // 校验错误
+              console.log(tabDataSaveResponse.verifyResults);
+              _self.verifyResults = tabDataSaveResponse.verifyResults;
+              _self.verifyResultModal = true;
+              _self.verifyResultCommand = command;
+              return;
+            }
+
+
+            const id = tabDataSaveResponse.recordId;
+            
             // 自动关闭
             var saveClose = Common.getRouteParam('saveClose');
             if (saveClose == 'true') {

+ 49 - 2
src/window1/tabFormEdit/TabFormEditModal.vue

@@ -315,6 +315,28 @@
       <a-modal v-model:open="modal3" :title="$t('lang.tabFormEdit.describe5')" @ok="cancelOk()" @cancel="cancelNo()">
         <div>{{ $t("lang.tabFormEdit.describe6") }}</div>
       </a-modal>
+
+      
+
+      <a-modal v-model:open="verifyResultModal" :title="$t('lang.tabFormEdit.verifyResult')" @ok="saveTabData(verifyResultCommand, false)"
+        @cancel="verifyResultModal = false">
+        <div v-if="verifyResults != null">
+          <template v-for="verifyResult in verifyResults">
+            <div v-if="verifyResult && verifyResult.code != 0" class="alert "
+              :class="{ 'alert-warning': verifyResult.verifyType == 'Optional', 'alert-danger': verifyResult.verifyType == 'Mandatory' }"
+              style="white-space: pre-wrap"
+              >
+              {{ verifyResult.message }}
+            </div>
+
+            <p class="bg-danger" style="font-size: medium; padding: 2rem;">
+              {{ $t("lang.tabFormEdit.submitConfirm") }}
+            </p>
+          </template>
+        </div>
+      </a-modal>
+
+
       <Loading v-if="loading" />
     </div>
   </a-modal>
@@ -495,6 +517,11 @@ export default {
       modal2: false,
       modal3: false,
       refreshFlag: false,
+
+      
+      verifyResultModal: false, // 校验结果模态框
+      verifyResults: null, // 校验结果
+      verifyResultCommand: null,
     };
   },
 
@@ -1393,7 +1420,7 @@ export default {
     },
 
     // 保存
-    saveTabData: function (command) {
+    saveTabData: function (command, verifyOptionalConditions) {
       var _self = this;
       var fieldWidgets1 = _self.$refs.fieldItem1;
       var fieldWidgets2 = _self.$refs.fieldItem2;
@@ -1481,14 +1508,34 @@ export default {
         var tabSaveData = {
           attributeValueDtos: attributeValueDtos,
           persistenceData: _self.modelData,
+          verifyOptionalConditions: (verifyOptionalConditions == null) ? true : verifyOptionalConditions,
         };
 
         _self.loading = true;
         WindowServerUtil.saveTabData(
           tabSaveData,
-          function (id) {
+          function (response) {
             _self.loading = false;
+            if (response.errorCode < 0) {
+              // 保存异常
+              Notify.error('Error', response.errorMessage, false);
+              return;
+            }
+
+            const tabDataSaveResponse = response.data;
+
+            if (response.errorCode == 1) {
+              // 校验错误
+              console.log(tabDataSaveResponse.verifyResults);
+              _self.verifyResults = tabDataSaveResponse.verifyResults;
+              _self.verifyResultModal = true;
+              _self.verifyResultCommand = command;
+              return;
+            }
+
 
+            const id = tabDataSaveResponse.recordId;
+            
             // 自动关闭
             var saveClose = Common.getRouteParam('saveClose');
             if (saveClose == 'true') {

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

@@ -118,6 +118,28 @@
     <Loading v-if="loading" />
   </div>
 
+    
+  <Modal v-model:show="verifyResultModal" @ok="saveTabData(verifyModelData, verifyIndex, false)" @cancel="verifyResultModal=false">
+    <template #header>{{ $t("lang.tabFormEdit.verifyResult") }}</template>
+    <div v-if="verifyResults != null">
+
+      <template v-for="verifyResult in verifyResults">
+        <div v-if="verifyResult && verifyResult.code != 0" class="alert "
+          :class="{ 'alert-warning': verifyResult.verifyType == 'Optional', 'alert-danger': verifyResult.verifyType == 'Mandatory' }"
+          style="white-space: pre-wrap">
+          {{ verifyResult.message }}
+        </div>
+
+        <p class="bg-danger" style="font-size: medium; padding: 2rem;">
+          {{ $t("lang.tabFormEdit.submitConfirm") }}
+        </p>
+
+      </template>
+
+    </div>
+  </Modal>
+
+
 
   <component
     :is="dynamicComponent" v-if="dynamicComponentOpen" v-model:open="dynamicComponentOpen"
@@ -262,6 +284,15 @@ export default {
       checkDatas: null,
       isSelectAllInput: false,
       nowModelIndex:0,
+
+      
+
+      
+      verifyResultModal: false, // 校验结果模态框
+      verifyResults: null,    // 校验结果
+      verifyModelData: null,  // 校验的数据
+      verifyIndex: null       // 校验的编号
+
     };
   },
   computed: {
@@ -1095,7 +1126,7 @@ export default {
           if (!modelData.editMode) {
             modelData.editMode = true;
           } else {
-            this.saveTabData(modelData, index);
+            this.saveTabData(modelData, index, true);
           }
           modelData.changed = true;
           _self.dataChanged = true;
@@ -1761,7 +1792,7 @@ export default {
      * @param  {[type]} modelData [description]
      * @return {[type]}           [description]
      */
-    saveTabData: function (modelData, index) {
+    saveTabData: function (modelData, index, verifyOptionalConditions) {
       var _self = this;
 
       var promises = [];
@@ -1788,11 +1819,36 @@ export default {
         var tabSaveData = {
           attributeValueDtos: null,
           persistenceData: modelData,
+          verifyOptionalConditions: (verifyOptionalConditions == null) ? true: verifyOptionalConditions,
+
         };
         _self.loading = true;
         WindowServerUtil.saveTabData(
           tabSaveData,
-          function (id) {
+          function (response) {
+            if(response.errorCode < 0){
+              _self.loading=false;
+              // 保存异常
+              Notify.error('Error', response.errorMessage, false);
+              return;
+            }
+
+            const tabDataSaveResponse = response.data;
+
+            if(response.errorCode == 1){
+              _self.loading=false;
+              // 校验错误
+              _self.verifyModelData = modelData;
+              _self.verifyIndex = index;
+              _self.verifyResults = tabDataSaveResponse.verifyResults;
+              _self.verifyResultModal = true;
+              return;
+            }
+
+
+            const id = tabDataSaveResponse.recordId;
+
+
             var tabLoadParam = {
               windowNo: _self.windowNo,
               tabIndex: modelData.tabIndex,