Quellcode durchsuchen

1.0.2 表格CellItem数字输入框防抖处理禁止刷新

liuyanpeng vor 1 Jahr
Ursprung
Commit
40bccf75c0

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-base-v5",
   "description": "Leanwo Prodog Client",
-  "version": "1.0.1",
+  "version": "1.0.2",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "ins": "npm install --registry http://wuzhixin.vip:4873",

+ 6 - 3
src/window1/tabGridView/CellItem.vue

@@ -229,7 +229,6 @@ import RedGreenSelect from '../../widget/RedGreenSelect.vue';
 
 
 
-
 export default {
 
   components: {
@@ -312,6 +311,7 @@ export default {
       validateMandatory: true,
       month: undefined,
       uuid1: Uuid.createUUID(),
+      timer:null,
     };
   },
 
@@ -368,7 +368,10 @@ export default {
             displayValue: [currentValue],
             fieldType: 'String',
           };
-          this.$emit('valueChanged', newFieldValue);
+          clearTimeout(this.timer); // 清除旧定时器
+          this.timer = setTimeout(() => {
+            this.$emit('valueChanged', newFieldValue);
+          }, 800); 
         }
       }
     },
@@ -428,7 +431,7 @@ export default {
      * 执行Callout
      */
     executeCallout: function (field) {
-      this.$emit('executeCallout', field);
+      this.$emit('executeCallout', field, true);
     },
 
     textChanged: function (value) {

+ 1 - 1
src/window1/tabGridView/CellTextItem.vue

@@ -466,7 +466,7 @@ export default {
          * 执行Callout
          */
     executeCallout: function (field) {
-      this.$emit('executeCallout', field);
+      this.$emit('executeCallout', field, true);
     },
 
     displayValue: function (modelData) {

+ 33 - 39
src/window1/tabGridView/GridBody.vue

@@ -1,5 +1,8 @@
 <template>
-  <tr v-if="showTabGridTitleFields" class="sticky-row" height="40px" :style="{ 'background-color': warningColor }" :class="{ 'warning': isSelected }">
+  <tr
+    v-if="showTabGridTitleFields" class="sticky-row" height="40px" :style="{ 'background-color': warningColor }"
+    :class="{ 'warning': isSelected }"
+  >
     <td rowspan="2" class="text-center  sticky-col">{{ serialNumber }}</td>
     <td rowspan="2" class="text-center  sticky-col" style="left:50px">
       <input v-model="isSelected" autocomplete="off" type="checkbox" @click="clickModelData(modelData)" />
@@ -69,26 +72,23 @@
         <td v-if="!modelData.editMode" v-show="gridFieldItem.visible" @click="clickRecord">
           <div>
             <CellTextItem
-              ref="cellTextItem" :window="window"
-              :grid-field-item="gridFieldItem" :model-data="modelData" :class-name="className"
-              :simple-filter-params="simpleFilterParams" :complex-filter-params="complexFilterParams"
-              :model-datas="modelDatas" :js-url="jsUrl"
-              :index="index" @execute-callout="executeCallout(gridFieldItem)" @delete-record="deleteRecord"
-              @refresh-datas="refreshDatas"
-              @edit-record="editRecord"
-              @read-record="readRecord"
+              ref="cellTextItem" :window="window" :grid-field-item="gridFieldItem" :model-data="modelData"
+              :class-name="className" :simple-filter-params="simpleFilterParams"
+              :complex-filter-params="complexFilterParams" :model-datas="modelDatas" :js-url="jsUrl" :index="index"
+              @execute-callout="executeCallout(gridFieldItem)" @delete-record="deleteRecord"
+              @refresh-datas="refreshDatas" @edit-record="editRecord" @read-record="readRecord"
             />
           </div>
         </td>
         <td
           v-else v-show="gridFieldItem.visible"
           :class="{ 'table-cell-searchwidget': fieldUtil.isSearchType(gridFieldItem) }" @click="clickRecord"
-        >        
+        >
           <CellItem
             :ref="'cellItem' + index" :scroll-object="scrollObject" :field-item="gridFieldItem"
             :model-data="modelData" :parent-model-data="parentModelData" :class-name="className" :window-no="windowNo"
             :tab-index="tabIndex" @value-changed="valueChanged($event, gridFieldItem)"
-            @execute-callout="executeCallout(gridFieldItem)"          
+            @execute-callout="executeCallout(gridFieldItem)"
           />
         </td>
       </template>
@@ -100,25 +100,18 @@
         processReportResult != null &&
           (processReportResult.reportResults != null ||
             processReportResult.processResult != null)
-      "
-      :process-report-result="processReportResult"
-      :pdf-only="false"
-      :excel-only="false"
+      " :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"
-  >
+  <Modal v-model:show="titleModal" :show-canel-button="false" :show-ok-button="false">
     <template #header>
       {{ tabButtonModel.tipsTitle }}
     </template>
     {{ tabButtonModel.tipsContent }}
-    <template #footer>      
+    <template #footer>
       <button type="button" class="btn btn-default" @click="titleModalClose">
         {{ $t("lang.tabButton.cancel") }}
       </button>
@@ -139,7 +132,7 @@ import Common from '../../common/Common.js';
 import Context from '../common/Context.js';
 import JsUtil from '../../common/JsUtil.js';
 import Language from '../../common/Language.js';
-import { Notify} from 'pc-component-v3';
+import { Notify } from 'pc-component-v3';
 
 export default {
 
@@ -209,7 +202,7 @@ export default {
     jsUrl: {
       type: String,
       default: null,
-    },    
+    },
     simpleFilterParams: {
       type: String,
       default: null,
@@ -244,7 +237,7 @@ export default {
       processReportResult: {},
       modal: false,
       titleModal: false,
-      tabButtonModel:{},
+      tabButtonModel: {},
     };
   },
   computed: {
@@ -377,11 +370,11 @@ export default {
     deleteRecord: function () {
       this.$emit('deleteRecord');
     },
-    refreshDatas: function(){
+    refreshDatas: function () {
       this.$emit('refreshDatas');
     },
 
-    buttonClick: function(){
+    buttonClick: function () {
       Notify.error('提示', '暂不支持该组件', false);
     },
 
@@ -389,7 +382,7 @@ export default {
     editRecord: function (modelData, index) {
       const validateResults = this.performValidate();
       const allTrue = validateResults.every(item => item === true);
-      if(allTrue) this.$emit('editRecord', modelData, index);
+      if (allTrue) this.$emit('editRecord', modelData, index);
     },
 
     readRecord: function (isRead, modelData, index) {
@@ -468,7 +461,7 @@ export default {
       return validateResults;
     },
     clickRecord: function () {
-    // 暂时取消双击打开
+      // 暂时取消双击打开
       var now = new Date().getTime();
       // if (now - this.lastClickTime < 500) {
       //   this.readRecord();
@@ -478,10 +471,10 @@ export default {
     /**
      * 执行Callout
      */
-    executeCallout: function (gridFieldItem) {
-      this.$emit('executeCallout', gridFieldItem);
+    executeCallout: function (gridFieldItem, isBtn) {
+      this.$emit('executeCallout', gridFieldItem, isBtn);
     },
-    
+
     /**
      * 获取字符串的哈希值
      * @param input
@@ -497,8 +490,8 @@ export default {
         hash = hash & hash; // 确保返回值是一个32位有符号整数
       }
       return Math.abs(hash).toString();
-    },    
-    
+    },
+
   },
 };
 </script>
@@ -533,14 +526,15 @@ export default {
 table {
   border-collapse: collapse;
   background: white;
-  
-  th, td {
-    border: 1px solid #e8e8e8;
-    padding: 8px;
-  }
 }
 
-table > tbody > tr:nth-of-type(odd) {
+table>th,
+td {
+  border: 1px solid #e8e8e8;
+  padding: 8px;
+}
+
+table>tbody>tr:nth-of-type(odd) {
   background-color: #f9f9f9;
 }
 

+ 4 - 5
src/window1/tabGridView/SubTabGridEdit.vue

@@ -795,10 +795,9 @@ export default {
      * @param  {[type]} calloutProcessReportNo [description]
      * @return {[type]}                  [description]
      */
-    callout: function (calloutProcessReportNo, modelData, index) {
+    callout: function (calloutProcessReportNo, modelData, index, isBtn) {
       var _self = this;
-      _self.loading = true;
-
+      if(isBtn) _self.loading = true;
       // 查询流程和报表的定义
       ProcessReportResource.uniqueByNo(calloutProcessReportNo).then(
         response => {
@@ -1367,10 +1366,10 @@ export default {
     /**
      * 执行Callout
      */
-    executeCallout: function (gridFieldItem, modelData, index) {
+    executeCallout: function (gridFieldItem, modelData, index, isBtn) {
       var _self = this;
       if (gridFieldItem.calloutProcessReportNo != null) {
-        _self.callout(gridFieldItem.calloutProcessReportNo, modelData, index);
+        _self.callout(gridFieldItem.calloutProcessReportNo, modelData, index, isBtn);
       }
     },