From 212af0b4bbc0f11e0b552d1bc3a4a73e52127e02 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 17 十月 2024 09:52:33 +0800
Subject: [PATCH] WMS

---
 项目代码/WMS/WIDESEA_WMSClient/src/components/basic/VolTable.vue |  534 +++++++++++++++++++++++++++++++----------------------------
 1 files changed, 281 insertions(+), 253 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/components/basic/VolTable.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/components/basic/VolTable.vue"
index cc6297e..0622c7c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/components/basic/VolTable.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/components/basic/VolTable.vue"
@@ -5,7 +5,7 @@
     :class="[
       textInline ? 'text-inline' : '',
       fxRight ? 'fx-right' : '',
-      isChrome ? 'chrome' : ''
+      isChrome ? 'chrome' : '',
     ]"
   >
     <div class="mask" v-show="loading"></div>
@@ -36,15 +36,8 @@
       :row-class-name="initIndex"
       :cell-style="getCellStyle"
       style="width: 100%"
-      :scrollbar-always-on="true" 
-      
+      :scrollbar-always-on="true"
     >
-      <el-table-column
-        v-if="columnIndex"
-        type="index"
-        :fixed="fixed"
-        width="55"
-      ></el-table-column>
       <el-table-column
         v-if="ck"
         type="selection"
@@ -52,7 +45,14 @@
         :selectable="selectable"
         width="55"
       ></el-table-column>
-      <!-- :selectable="selectable" -->
+      <el-table-column
+        v-if="columnIndex"
+        type="index"
+        :fixed="fixed"
+        label="搴忓彿"
+        width="55"
+      ></el-table-column>
+
       <!-- 2020.10.10绉婚櫎table绗竴琛屽己鍒舵帓搴� -->
       <el-table-column
         v-for="(column, cindex) in filterColumns"
@@ -64,7 +64,7 @@
         :key="column.field + cindex"
         :align="column.align"
         :sortable="column.sort ? 'custom' : false"
-        :show-overflow-tooltip="column.showOverflowTooltip"
+        :show-overflow-tooltip="true"
       >
         <template #header>
           <span
@@ -135,40 +135,55 @@
           <!-- 鍚敤鍙屽嚮缂栬緫鍔熻兘锛屽甫缂栬緫鍔熻兘鐨勪笉浼氭覆鏌撲笅鎷夋鏂囨湰鑳屾櫙棰滆壊 -->
           <!-- @click="rowBeginEdit(scope.$index,cindex)" -->
           <!-- 2021.09.21澧炲姞缂栬緫鏃跺readonly灞炴�у垽鏂� -->
-           <template v-else-if="column.edit&&!column.readonly&&['file', 'img','excel'].indexOf(column.edit.type) != -1" >
-                <div style="display:flex;align-items: center;" @click.stop>
-                  <i style="padding: 3px;margin-right: 10px;color:#8f9293;cursor: pointer;" @click="showUpload(scope.row, column)" class="el-icon-upload"></i>
-                   <img
-                    v-if="column.edit.type == 'img'"
-                    v-for="(file, imgIndex) in getFilePath(
-                      scope.row[column.field],
-                      column
-                    )"
-                    :key="imgIndex"
-                    :onerror="defaultImg"
-                    @click="viewImg(scope.row, column, file.path, $event)"
-                    class="table-img"
-                    :src="file.path"
-                  />
-                  <a
-                    style="margin-right: 8px"
-                    v-else
-                    class="t-file"
-                    v-for="(file, fIndex) in getFilePath(
-                      scope.row[column.field],
-                      column
-                    )"
-                    :key="fIndex"
-                    @click="dowloadFile(file)"
-                    >{{ file.name }}</a
-                  >
-                </div>
+          <template
+            v-else-if="
+              column.edit &&
+              !column.readonly &&
+              ['file', 'img', 'excel'].indexOf(column.edit.type) != -1
+            "
+          >
+            <div style="display: flex; align-items: center" @click.stop>
+              <i
+                style="
+                  padding: 3px;
+                  margin-right: 10px;
+                  color: #8f9293;
+                  cursor: pointer;
+                "
+                @click="showUpload(scope.row, column)"
+                class="el-icon-upload"
+              ></i>
+              <img
+                v-show="column.edit.type == 'img'"
+                v-for="(file, imgIndex) in getFilePath(
+                  scope.row[column.field],
+                  column
+                )"
+                :key="imgIndex"
+                :onerror="defaultImg"
+                @click="viewImg(scope.row, column, file.path, $event)"
+                class="table-img"
+                :src="file.path"
+              />
+              <a
+                style="margin-right: 8px"
+                v-show="column.edit.type != 'img'"
+                class="t-file"
+                v-for="(file, fIndex) in getFilePath(
+                  scope.row[column.field],
+                  column
+                )"
+                :key="fIndex"
+                @click="dowloadFile(file)"
+                >{{ file.name }}</a
+              >
+            </div>
           </template>
           <div
             v-else-if="
               column.edit &&
-                !column.readonly &&
-                (column.edit.keep || edit.rowIndex == scope.$index)
+              !column.readonly &&
+              (column.edit.keep || edit.rowIndex == scope.$index)
             "
             class="edit-el"
           >
@@ -274,7 +289,7 @@
                         ? true
                         : false
                     "
-                    :multiple="column.edit.type == 'select' ? false : true"
+                    :multiple="column.edit.type == 'select'"
                     :placeholder="column.placeholder || column.title"
                     :autocomplete="column.autocomplete"
                     @change="
@@ -440,231 +455,239 @@
     lazy
   >
     <!-- 涓婁紶鍥剧墖銆乪xcel鎴栧叾浠栨枃浠躲�佹枃浠舵暟閲忋�佸ぇ灏忛檺鍒堕兘鍙互锛屽弬鐓olupload缁勪欢api -->
-    <div style="height: 200px;display: flex;align-items: center;">
+    <div style="height: 200px; display: flex; align-items: center">
       <VolUpload
-      style="text-align: center; "
-      :autoUpload="currentColumn.edit.autoUpload"
-      :multiple="currentColumn.edit.multiple"
-      :url="uploadUrl"
-      :max-file="currentColumn.edit.maxFile"
-      :img="currentColumn.edit.type == 'img'"
-      :excel="currentColumn.edit.type == 'excel'"
-      :fileTypes="currentColumn.edit.fileTypes ? currentColumn.edit.fileTypes : []"
-      :fileInfo="fileInfo"
-      :upload-after="uploadAfter"
-    >
-      <div>{{ currentColumn.message}}</div>
-    </VolUpload>
+        style="text-align: center"
+        :autoUpload="currentColumn.edit.autoUpload"
+        :multiple="currentColumn.edit.multiple"
+        :url="uploadUrl"
+        :max-file="currentColumn.edit.maxFile"
+        :img="currentColumn.edit.type == 'img'"
+        :excel="currentColumn.edit.type == 'excel'"
+        :fileTypes="
+          currentColumn.edit.fileTypes ? currentColumn.edit.fileTypes : []
+        "
+        :fileInfo="fileInfo"
+        :upload-after="uploadAfter"
+      >
+        <div>{{ currentColumn.message }}</div>
+      </VolUpload>
     </div>
     <template #footer>
-        <div style="text-align: center; ">
-          <el-button type="default" size="small" @click="uploadModel=false">鍏抽棴</el-button >
-          <el-button type="primary" size="small" @click="saveUpload" >淇濆瓨</el-button >
-        </div>
+      <div style="text-align: center">
+        <el-button type="default" size="small" @click="uploadModel = false"
+          >鍏抽棴</el-button
+        >
+        <el-button type="primary" size="small" @click="saveUpload"
+          >淇濆瓨</el-button
+        >
+      </div>
     </template>
   </VolBox>
-
 </template>
 <script>
-import VolTableRender from './VolTable/VolTableRender';
+import VolTableRender from "./VolTable/VolTableRender";
 let _errMsg;
-import { defineComponent,defineAsyncComponent } from 'vue';
+import { defineComponent, defineAsyncComponent } from "vue";
 export default defineComponent({
   //https://github.com/element-plus/element-plus/issues/1483
   //娌℃湁鍘熷厛鐨剆election灞炴�т簡锛岀湅issue涓婁娇鐢╯elect/selectall鑾峰彇
   //鐩戝惉鏁扮粍闀垮害锛屽鏋滃垹闄や簡鏁版嵁锛岀幇鍦ㄥ彧鑳借杩竻闄ゆ墍鏈夐�変腑鐨勮
   watch: {
-    'tableData.length': {
+    "tableData.length": {
       handler(newLen, oldLen) {
         this.watchRowSelectChange(newLen, oldLen);
-      }
+      },
     },
-    'rowData.length': {
+    "rowData.length": {
       handler(newLen, oldLen) {
         this.watchRowSelectChange(newLen, oldLen);
-      }
-    }
+      },
+    },
   },
-  components: { 'table-render': VolTableRender,
-  VolUpload: defineAsyncComponent(() =>import("@/components/basic/VolUpload.vue") ),
-  VolBox: defineAsyncComponent(() => import("@/components/basic/VolBox.vue")),
-},
+  components: {
+    "table-render": VolTableRender,
+    VolUpload: defineAsyncComponent(() =>
+      import("@/components/basic/VolUpload.vue")
+    ),
+    VolBox: defineAsyncComponent(() => import("@/components/basic/VolBox.vue")),
+  },
   props: {
     rowKey: {
       // 鏍戝舰缁撴瀯鐨勪富閿瓧娈碉紝濡傛灉璁剧疆鍊奸粯璁や細寮�鍚爲褰able锛涙敞鎰弐owKey瀛楁鐨勫�煎繀椤绘槸鍞竴锛�2021.05.02锛�
       typeof: String,
-      default: undefined
+      default: undefined,
     },
     loadTreeChildren: {
       // 鏍戝舰缁撴瀯鍔犺浇瀛愯妭鐐�
       type: Function,
       default: (tree, treeNode, resolve) => {
         return resolve([]);
-      }
+      },
     },
     textInline: {
       // 琛ㄦ牸鍐呭瓒呭嚭鍚庢槸鍚︽崲琛屾樉绀猴紙2020.01.16锛�
       type: Boolean,
-      default: true
+      default: true,
     },
     tableData: {
       // 琛ㄦ暟鎹簮,閰嶇疆浜唘rl灏变笉鐢ㄤ紶杩欎釜鍙傛暟浜�
       type: Array,
       default: () => {
         return [];
-      }
+      },
     },
     columns: {
       type: Array,
-      default: []
+      default: [],
     },
     height: {
       type: Number,
-      default: 0
+      default: 0,
     },
     maxHeight: {
       type: Number,
-      default: 0
+      default: 0,
     },
     linkView: {
       type: Function,
-      default: function() {
+      default: function () {
         return 1;
-      }
+      },
     },
     pagination: {
       type: Object,
-      default: function() {
-        return { total: 0, size: 30, sortName: '' };
-      }
+      default: function () {
+        return { total: 0, size: 30, sortName: "" };
+      },
     },
     url: {
       type: String,
-      default: ''
+      default: "",
     },
     paginationHide: {
       type: Boolean,
-      default: true
+      default: true,
     },
     color: {
       type: Boolean,
-      default: true
+      default: true,
     },
     index: {
       // 鏄惁鍒涘缓绱㈠紩鍙�,濡傛灉闇�瑕佽〃鏍肩紪杈戝姛鑳斤紝杩欓噷闇�瑕佽缃负true
       type: Boolean,
-      default: false
+      default: false,
     },
     allowEmpty: {
       // 琛ㄦ牸鏁版嵁涓虹┖鏃舵槸鍚﹂粯璁や负--
       type: Boolean,
-      default: true
+      default: true,
     },
     defaultLoadPage: {
       // 浼犲叆浜唘rl锛屾槸鍚﹂粯璁ゅ姞杞借〃鏍兼暟鎹�
       type: Boolean,
-      default: true
+      default: true,
     },
     loadKey: {
       // 鏄惁鑷姩浠庡悗鍙板姞杞芥暟鎹簮
       type: Boolean,
-      default: true
+      default: true,
     },
     single: {
       type: Boolean, // 鏄惁鍗曢��
-      default: false
+      default: false,
     },
     doubleEdit: {
       type: Boolean, // 鏄惁鍙屽嚮鍚敤缂栬緫鍔熻兘
-      default: true
+      default: true,
     },
     beginEdit: {
       // 缂栬緫寮�濮�
       type: Function,
-      default: function(row, column, index) {
+      default: function (row, column, index) {
         return true;
-      }
+      },
     },
     endEditBefore: {
       // 缁撴潫缂栬緫鍓�
       type: Function,
-      default: function(row, column, index) {
+      default: function (row, column, index) {
         return true;
-      }
+      },
     },
     endEditAfter: {
       // 缁撴潫缂栬緫鍓�
       type: Function,
-      default: function(row, column, index) {
+      default: function (row, column, index) {
         return true;
-      }
+      },
     },
     ck: {
       // 鏄惁鏄剧ずcheckbox
       type: Boolean,
-      default: true
+      default: true,
     },
     columnIndex: {
       // 鏄惁鏄剧ず琛屽彿(2020..11.1)
       type: Boolean,
-      default: true
+      default: true,
     },
     highlightCurrentRow: {
       //澧炲姞閫変腑琛岄珮浜樉绀�(2022.10.07)
       type: Boolean,
-      default: true
+      default: true,
     },
     select2Count: {
       //瓒呭嚭鏁伴噺鏄剧ずselect2缁勪欢
       type: Number,
-      default: 500
+      default: 500,
     },
     selectable: {
       type: Function,
       default: (row, index) => {
         return true;
-      }
-    }
+      },
+    },
   },
   data() {
     return {
-      fixed: true, //鏄浐瀹氳鍙蜂笌checkbox
+      fixed: false, //鏄浐瀹氳鍙蜂笌checkbox
       clickEdit: true, //2021.07.17璁剧疆涓虹偣鍑昏缁撴潫缂栬緫
       randomTableKey: 1,
       visiblyColumns: [],
-      key: '',
+      key: "",
       realHeight: 0,
       realMaxHeight: 0,
       enableEdit: false, // 鏄惁鍚〃鏍肩敤缂栬緫鍔熻兘
-      empty: this.allowEmpty ? '' : '--',
-      defaultImg: 'this.src="' + require('@/assets/imgs/error.png') + '"',
+      empty: this.allowEmpty ? "" : "--",
+      defaultImg: 'this.src="' + require("@/assets/imgs/error.png") + '"',
       loading: false,
       footer: {},
       total: 0,
       formatConfig: {},
       // defaultColor: "",
       // 2020.09.06璋冩暣table鍒楁暟鎹簮鐨勮儗鏅鑹�
-      colors: ['', 'warning', 'success', 'danger', 'info'],
+      colors: ["", "warning", "success", "danger", "info"],
       rule: {
         phone: /^[1][3,4,5,6,7,8,9][0-9]{9}$/,
         decimal: /(^[\-0-9][0-9]*(.[0-9]+)?)$/,
-        number: /(^[\-0-9][0-9]*([0-9]+)?)$/
+        number: /(^[\-0-9][0-9]*([0-9]+)?)$/,
       },
       columnNames: [],
       rowData: [],
       paginations: {
-        sort: '',
-        order: 'desc',
-        Foots: '',
+        sort: "",
+        order: "desc",
+        Foots: "",
         total: 0,
         // 2020.08.29澧炲姞鑷畾涔夊垎椤垫潯澶у皬
         sizes: [30, 60, 100, 120],
         size: 30, // 榛樿鍒嗛〉澶у皬
         Wheres: [],
         page: 1,
-        rows: 30
+        rows: 30,
       },
-      errorFiled: '',
+      errorFiled: "",
       edit: { columnIndex: -1, rowIndex: -1 }, // 褰撳墠鍙屽嚮缂栬緫鐨勮涓庡垪鍧愭爣
       editStatus: {},
       summary: false, // 鏄惁鏄剧ず鍚堣
@@ -679,11 +702,11 @@
       //vol-table甯︽暟鎹簮鐨勫崟鍏冩牸鏄惁鍚敤tag鏍囩(涓嬫媺妗嗙瓑鍗曞厓鏍间互tag鏍囩鏄剧ず)
       //2023.04.02鏇存柊voltable涓巑ain.js
       useTag: true,
-      currentRow:{},
-      currentColumn:[],
-      fileInfo:[],
-      uploadUrl:"",
-      uploadModel:false
+      currentRow: {},
+      currentColumn: [],
+      fileInfo: [],
+      uploadUrl: "",
+      uploadModel: false,
     };
   },
   created() {
@@ -702,12 +725,12 @@
     this.realHeight = this.getHeight();
     this.realMaxHeight = this.getMaxHeight();
     this.fxRight = this.columns.some((x) => {
-      return x.fixed == 'right';
+      return x.fixed == "right";
     });
     //2021.09.21绉婚櫎寮哄埗鍥哄畾琛屽彿涓巆heckbox鍒�
     if (
       this.columns.some((x) => {
-        return x.fixed && x.fixed != 'right';
+        return x.fixed && x.fixed != "right";
       })
     ) {
       this.fixed = true;
@@ -729,9 +752,9 @@
     // 浠庡悗鍙板姞涓嬫媺妗嗙殑[鏄惁鍚敤鐨刔鏁版嵁婧�
     let keys = [];
     let columnBind = [];
-    this.summaryData.push('鍚堣');
+    this.summaryData.push("鍚堣");
     if (this.columnIndex) {
-      this.summaryData.push(' ');
+      this.summaryData.push(" ");
     }
     this.columns.forEach((x, _index) => {
       if (x.cellStyle) {
@@ -740,7 +763,7 @@
       if (!x.hidden) {
         // this.summaryIndex[x.field] = _index;
         // 2020.10.11淇姹傚拰鍒楅敊浣嶇殑闂
-        this.summaryData.push('');
+        this.summaryData.push("");
         this.summaryIndex[x.field] = this.summaryData.length - 1;
       }
       // 姹傚拰
@@ -761,7 +784,7 @@
     });
     if (keys.length > 0) {
       this.http
-        .post('/api/Sys_Dictionary/GetVueDictionary', keys)
+        .post("/api/Sys_Dictionary/GetVueDictionary", keys)
         .then((dic) => {
           dic.forEach((x) => {
             if (x.data.length > this.select2Count) {
@@ -774,7 +797,7 @@
               // 杞崲鏁版嵁婧愮殑绫诲瀷涓庡垪鐨勭被鍨嬩竴鑷�(2020.04.04)
               if (
                 c.key == x.dicNo &&
-                (c.valueTyoe == 'int' || c.valueTyoe == 'sbyte')
+                (c.valueTyoe == "int" || c.valueTyoe == "sbyte")
               ) {
                 x.data.forEach((d) => {
                   // 2020.09.01澧炲姞瀵规暟瀛楃被鍨嬬殑浜屾鍒ゆ柇
@@ -796,7 +819,7 @@
       this.paginations.rows = this.pagination.size;
     }
     this.enableEdit = this.columns.some((x) => {
-      return x.hasOwnProperty('edit');
+      return x.hasOwnProperty("edit");
     });
     let keyColumn = this.columns.find((x) => {
       return x.isKey;
@@ -814,7 +837,7 @@
         }
         return !x.hidden;
       });
-    }
+    },
   },
   methods: {
     watchRowSelectChange(newLen, oldLen) {
@@ -861,29 +884,16 @@
     },
     rowDbClick(row, column, event) {
       //2021.05.23澧炲姞鍙屽嚮琛屼簨浠�
-      this.$emit('rowDbClick', { row, column, event });
+      this.$emit("rowDbClick", { row, column, event });
     },
     rowClick(row, column, event) {
-    //   row.selectable = !row.selectable;
-    // this.$refs.table.toggleRowSelection(row);
-
-    
-    // if(this.batchDeleteArr.length > 0){
-    //     this.checkNum = this.batchDeleteArr.length
-    //     this.isCheck = true
-    // }else{
-    //     this.isCheck = false
-    // }
-
-
-
       //2022.02.20澧炲姞鐐瑰嚮鏃惰〃鏍煎弬鏁板垽鏂�
       if (!column) {
         return;
       }
       //姝e湪缂栬緫鏃讹紝绂佹鍑哄彂rowClick浜嬩欢
       if (this.edit.rowIndex == -1) {
-        this.$emit('rowClick', { row, column, event });
+        this.$emit("rowClick", { row, column, event });
       }
       // 鐐瑰嚮琛屼簨浠�(2020.11.07)
 
@@ -911,7 +921,7 @@
         //褰撴鍦ㄧ紪杈戯紝涓旂偣鍑诲埌鍏朵粬琛屾椂锛屽湪鍘熺紪杈戠殑琛岀粨鏉熺紪杈戝悗锛岃Е鍙戞柊琛岀殑rowClick浜嬩欢
         //姝e湪缂栬緫鏃讹紝绂佹鍑哄彂rowClick浜嬩欢
         if (this.edit.rowIndex == -1) {
-          this.$emit('rowClick', { row, column, event });
+          this.$emit("rowClick", { row, column, event });
         }
       }
       this.rowBeginEdit(row, column);
@@ -921,7 +931,7 @@
         file.path,
         file.name,
         {
-          Authorization: this.$store.getters.getToken()
+          Authorization: this.$store.getters.getToken(),
         },
         this.http.ipAddress
       );
@@ -935,17 +945,17 @@
         return column.formatter(pathSring);
       }
       let filePath;
-      if (column.base64 && pathSring.indexOf('data') != -1) {
-        filePath = (',' + pathSring)
-          .split(',data')
+      if (column.base64 && pathSring.indexOf("data") != -1) {
+        filePath = ("," + pathSring)
+          .split(",data")
           .filter((x) => {
             return x;
           })
           .map((m) => {
-            return 'data' + m;
+            return "data" + m;
           });
       } else {
-        filePath = pathSring.replace(/\\/g, '/').split(',');
+        filePath = pathSring.replace(/\\/g, "/").split(",");
       }
 
       let fileInfo = [];
@@ -954,17 +964,17 @@
         // 2020.12.19澧炲姞base64鍥剧墖鏄剧ず
         if (column.base64) {
           fileInfo.push({
-            name: '',
+            name: "",
             path:
-              (file.indexOf('data') == -1 ? 'data:image/png;base64,' : '') +
-              file
+              (file.indexOf("data") == -1 ? "data:image/png;base64," : "") +
+              file,
           });
-        } else if (file.indexOf('.') != -1) {
-          let splitFile = file.split('/');
+        } else if (file.indexOf(".") != -1) {
+          let splitFile = file.split("/");
           if (splitFile.length > 0) {
             fileInfo.push({
               name: splitFile[splitFile.length - 1],
-              path: this.base.isUrl(file) ? file : this.http.ipAddress + file
+              path: this.base.isUrl(file) ? file : this.http.ipAddress + file,
             });
           }
         }
@@ -986,7 +996,7 @@
           this.paginations.wheres.splice(0);
         }
       }
-      this.errorFiled = '';
+      this.errorFiled = "";
       this.edit.columnIndex = -1;
       this.edit.rowIndex = -1;
     },
@@ -1062,13 +1072,13 @@
         if (
           //涓嶈兘缂栬緫鐨勫瓧娈点�乻witch锛岀偣鍑讳笉寮�鍚惎缂栬緫鍔熻兘
           !_row.edit ||
-          (_row.edit.keep && _row.edit.type == 'switch')
+          (_row.edit.keep && _row.edit.type == "switch")
         ) {
           return;
         }
       }
       if (!this.enableEdit) return;
-      _errMsg = '';
+      _errMsg = "";
       // 缂栬緫鍓�
       this.columns
         .filter((x) => {
@@ -1076,21 +1086,21 @@
         })
         .forEach((column) => {
           let val = row[column.field];
-          if (typeof column.bind.data[0].key == 'string') {
-            if (typeof val == 'number') {
-              row[column.field] = row[column.field] + '';
+          if (typeof column.bind.data[0].key == "string") {
+            if (typeof val == "number") {
+              row[column.field] = row[column.field] + "";
             }
           } else {
-            if (typeof val == 'string' && val) {
+            if (typeof val == "string" && val) {
               let _val = val * 1;
-              if (_val + '' === val) {
+              if (_val + "" === val) {
                 row[column.field] = _val;
               }
             }
           }
         });
       if (!this.beginEdit(row, column, row.elementIndex)) return;
-      if (row.hasOwnProperty('elementIndex')) {
+      if (row.hasOwnProperty("elementIndex")) {
         if (this.edit.rowIndex == row.elementIndex) {
           return;
         }
@@ -1150,16 +1160,16 @@
         this.$message.error(option1.title + _errMsg);
         return false;
       }
-      this.errorFiled = '';
+      this.errorFiled = "";
       return true;
     },
     validateColum(option, data) {
       if (option.hidden || option.bind) return true;
       let val = data[option.field];
       if (option.require || option.required) {
-        if (val != '0' && (val === '' || val === undefined)) {
+        if (val != "0" && (val === "" || val === undefined)) {
           if (!this.errorFiled) {
-            _errMsg = '涓嶈兘涓虹┖';
+            _errMsg = "涓嶈兘涓虹┖";
           }
           return false;
         }
@@ -1169,52 +1179,52 @@
       }
       let editType = option.edit.type;
       // 楠岃瘉鏁板瓧
-      if (editType == 'int' || editType == 'decimal' || editType == 'number') {
-        if (val == '' || val == undefined) return true;
-        if (editType == 'decimal') {
+      if (editType == "int" || editType == "decimal" || editType == "number") {
+        if (val == "" || val == undefined) return true;
+        if (editType == "decimal") {
           if (!this.rule.decimal.test(val)) {
-            _errMsg = '鍙兘鏄暟瀛�';
+            _errMsg = "鍙兘鏄暟瀛�";
             return false;
           }
         } else if (!this.rule.decimal.test(val)) {
-          _errMsg = '鍙兘鏄暟瀛�';
+          _errMsg = "鍙兘鏄暟瀛�";
           return false;
         }
         if (
           option.edit.min != undefined &&
-          typeof option.edit.min === 'number' &&
+          typeof option.edit.min === "number" &&
           val < option.edit.min
         ) {
-          _errMsg = '涓嶈兘灏忎簬' + option.edit.min;
+          _errMsg = "涓嶈兘灏忎簬" + option.edit.min;
           return false;
         }
         if (
           option.edit.max != undefined &&
-          typeof option.edit.max === 'number' &&
+          typeof option.edit.max === "number" &&
           val > option.edit.max
         ) {
-          _errMsg = '涓嶈兘澶т簬' + option.edit.max;
+          _errMsg = "涓嶈兘澶т簬" + option.edit.max;
           return false;
         }
         return true;
       }
 
       // 楠岃瘉瀛楃涓�
-      if (val && (editType == 'text' || editType == 'string')) {
+      if (val && (editType == "text" || editType == "string")) {
         if (
           option.edit.min != undefined &&
-          typeof option.edit.min === 'number' &&
+          typeof option.edit.min === "number" &&
           val.length < option.edit.min
         ) {
-          _errMsg = '鑷冲皯' + option.edit.min + '涓瓧绗�';
+          _errMsg = "鑷冲皯" + option.edit.min + "涓瓧绗�";
           return false;
         }
         if (
           option.edit.max != undefined &&
-          typeof option.edit.max === 'number' &&
+          typeof option.edit.max === "number" &&
           val.length > option.edit.max
         ) {
-          _errMsg = '鏈�澶�' + option.edit.max + '涓瓧绗�';
+          _errMsg = "鏈�澶�" + option.edit.max + "涓瓧绗�";
           return false;
         }
       }
@@ -1222,7 +1232,7 @@
     },
     delRow() {
       let rows = this.getSelected();
-      if (rows.length == 0) return this.$Message.error('璇烽�夋嫨瑕佸垹闄ょ殑琛�!');
+      if (rows.length == 0) return this.$Message.error("璇烽�夋嫨瑕佸垹闄ょ殑琛�!");
 
       let data = this.url ? this.rowData : this.tableData;
       let indexArr = this.getSelectedIndex();
@@ -1262,8 +1272,8 @@
         // 2022.05.06 娣诲姞琛屾椂锛屽鏋滃垪鏈夌紪杈戝睘鎬э紝璁剧疆寮�鍚紪杈�(閬垮厤鍏抽棴缂栬緫鍚庯紝鏃犳硶鍐嶆鍚敤缂栬緫)??
         //x.readonly = false;
         if (!row.hasOwnProperty(x.field)) {
-          if (x.edit && x.edit.type == 'switch') {
-            row[x.field] = x.type == 'bool' ? false : 0;
+          if (x.edit && x.edit.type == "switch") {
+            row[x.field] = x.type == "bool" ? false : 0;
           } else if (!row.hidden) {
             // 2020.09.06娣诲姞琛屾椂锛岃缃粯璁ゅ瓧娈�
             row[x.field] = undefined;
@@ -1308,7 +1318,7 @@
         let key = column.bind.key;
         let data = [];
         rows.forEach((row) => {
-          if (row[column.field] || row[column.field] == '0') {
+          if (row[column.field] || row[column.field] == "0") {
             if (data.indexOf(row[column.field]) == -1) {
               data.push(row[column.field]);
             }
@@ -1321,7 +1331,7 @@
       if (remoteInfo.length == 0) return;
       // ha= Object.assign([], ha, hb)
       this.http
-        .post('/api/Sys_Dictionary/GetTableDictionary', remoteInfo)
+        .post("/api/Sys_Dictionary/GetTableDictionary", remoteInfo)
         .then((dic) => {
           dic.forEach((x) => {
             this.remoteColumns.forEach((column) => {
@@ -1331,7 +1341,7 @@
               }
             });
           });
-          this.$emit('dicInited', dic);
+          this.$emit("dicInited", dic);
         });
     },
     load(query, isResetPage) {
@@ -1345,7 +1355,7 @@
         rows: this.paginations.rows,
         sort: this.paginations.sort,
         order: this.paginations.order,
-        wheres: [] // 鏌ヨ鏉′欢锛屾牸寮忎负[{ name: "瀛楁", value: "xx" }]
+        wheres: [], // 鏌ヨ鏉′欢锛屾牸寮忎负[{ name: "瀛楁", value: "xx" }]
       };
       let status = true;
       // 鍚堝苟鏌ヨ淇℃伅(鍖呮煡璇㈠垎椤点�佹帓搴忋�佹煡璇㈡潯浠剁瓑)
@@ -1358,7 +1368,7 @@
           callBack(true);
         })
       */
-      this.$emit('loadBefore', param, (result) => {
+      this.$emit("loadBefore", param, (result) => {
         status = result;
       });
       if (!status) return;
@@ -1378,7 +1388,7 @@
           // 鏌ヨ杩斿洖缁撴灉鍚庡鐞�
           // 2020.10.30澧炲姞鏌ヨ鍚庤繑鍥炴墍鏈夌殑鏌ヨ淇℃伅
           this.$emit(
-            'loadAfter',
+            "loadAfter",
             data.rows || [],
             (result) => {
               status = result;
@@ -1406,11 +1416,11 @@
       this.summaryData.splice(0);
       // 寮�鍚簡琛屽彿鐨勶紝+1
       if (this.columnIndex) {
-        this.summaryData.push('');
+        this.summaryData.push("");
       }
       // 濡傛灉鏈塩heckbox锛屽簲璇ョ畻浣滄槸绗竴琛�
       if (this.ck) {
-        this.summaryData.push('');
+        this.summaryData.push("");
       }
 
       this.columns.forEach((col) => {
@@ -1422,8 +1432,8 @@
           this.getColumnSummaries(col, data);
         }
       });
-      if (this.summaryData.length > 0 && this.summaryData[0] == '') {
-        this.summaryData[0] = '鍚堣';
+      if (this.summaryData.length > 0 && this.summaryData[0] == "") {
+        this.summaryData[0] = "鍚堣";
       }
     },
     getColumnSummaries(col, data) {
@@ -1432,12 +1442,12 @@
           let sum = data.summary[col.field];
           if (sum) {
             sum =
-              (sum * 1.0).toFixed(col.numberLength || 2).replace('.00', '') *
+              (sum * 1.0).toFixed(col.numberLength || 2).replace(".00", "") *
               1.0;
           }
           this.summaryData.push(sum);
         } else {
-          this.summaryData.push('');
+          this.summaryData.push("");
         }
       }
     },
@@ -1453,7 +1463,7 @@
     },
     sortChange(sort) {
       this.paginations.sort = sort.prop;
-      this.paginations.order = sort.order == 'ascending' ? 'asc' : 'desc';
+      this.paginations.order = sort.order == "ascending" ? "asc" : "desc";
       this.load();
     },
     resetPage() {
@@ -1467,7 +1477,7 @@
       this.selectRows = selection;
       if (this.single) {
         if (selection.length == 1) {
-          this.$emit('rowChange', selection[0]);
+          this.$emit("rowChange", selection[0]);
         }
         if (selection.length > 1) {
           let _row = selection[selection.length - 1];
@@ -1476,18 +1486,18 @@
         }
       }
       // 灏唖electionchange鏆撮湶鍑哄幓
-      this.$emit('selectionChange', selection);
+      this.$emit("selectionChange", selection);
     },
     getColor(row, column) {
       let val = row[column.field];
-      if (column.getColor && typeof column.getColor === 'function') {
+      if (column.getColor && typeof column.getColor === "function") {
         let _color = column.getColor(row, column);
         if (_color) {
           return _color;
         }
       }
-      if (!val && val != '0') {
-        return '';
+      if (!val && val != "0") {
+        return "";
       }
       if (!this.formatConfig[column.field]) {
         this.formatConfig[column.field] = [val];
@@ -1498,7 +1508,7 @@
         return this.colors[index];
       }
       if (this.formatConfig[column.field].length > 5) {
-        return '';
+        return "";
       }
 
       if (index == -1) {
@@ -1508,38 +1518,45 @@
       return this.colors[index];
     },
     formatterDate(row, column) {
-      return (row[column.field] || '').substr(0, 10);
+      return (row[column.field] || "").substr(0, 10);
     },
     formatter(row, column, template) {
       if (!template) return row[column.property];
       let val = row[column.field];
       if (!val && val != 0) return val;
       // 鏄惁鍊�
-      if (column.edit && column.edit.type == 'switch') {
-        return val ? '鏄�' : '鍚�';
+      if (column.edit && column.edit.type == "switch") {
+        return val ? "鏄�" : "鍚�";
       }
       if (!column.bind || !column.bind.data) {
         return row[column.field];
       }
 
-      if (column.edit && (column.edit.type == 'selectList'||column.edit.type=='treeSelect')) {
+      if (
+        column.edit &&
+        (column.edit.type == "selectList" || column.edit.type == "treeSelect")
+      ) {
         if (!Array.isArray(val)) {
-          row[column.field] = val.split(',');
+          row[column.field] = val.split(",");
         } else {
-          val = val.join(',');
+          val = val.join(",");
         }
         return this.getSelectFormatter(column, val);
       }
       // 缂栬緫澶氶�塼able鏄剧ず
-      if (column.bind.type == 'selectList' || column.bind.type == 'checkbox'||column.bind.type=='treeSelect') {
-       // if (typeof val === 'string' && val.indexOf(',') != -1) {
-          return this.getSelectFormatter(column, val+'');
-      //  }
+      if (
+        column.bind.type == "selectList" ||
+        column.bind.type == "checkbox" ||
+        column.bind.type == "treeSelect"
+      ) {
+        // if (typeof val === 'string' && val.indexOf(',') != -1) {
+        return this.getSelectFormatter(column, val + "");
+        //  }
       }
       let source = column.bind.data.filter((x) => {
         // return x.key != "" && x.key == val;
         // 2020.06.06淇鍗曠嫭浣跨敤table缁勪欢鏃�,key涓烘暟瀛�0鏃惰浆鎹㈡垚鏂囨湰澶辫触鐨勯棶棰�
-        return x.key !== '' && x.key !== undefined && x.key + '' === val + '';
+        return x.key !== "" && x.key !== undefined && x.key + "" === val + "";
       });
       if (source && source.length > 0) val = source[0].label || source[0].value;
       return val;
@@ -1548,12 +1565,16 @@
       // 缂栬緫澶氶�塼able鏄剧ず
       let valArr = val.split(",");
       for (let index = 0; index < valArr.length; index++) {
-        ( column.bind.orginData&&column.bind.orginData.length
-          ?column.bind.orginData
-          :column.bind.data)
-        .forEach((x) => {
+        (column.bind.orginData && column.bind.orginData.length
+          ? column.bind.orginData
+          : column.bind.data
+        ).forEach((x) => {
           // 2020.06.06淇鏁版嵁婧愪负selectList鏃�,key涓烘暟瀛�0鏃朵笉鑳借浆鎹㈡枃鏈殑闂
-          if (x.key !== "" && x.key !== undefined && x.key + "" == valArr[index] + "") {
+          if (
+            x.key !== "" &&
+            x.key !== undefined &&
+            x.key + "" == valArr[index] + ""
+          ) {
             valArr[index] = x.label || x.value;
           }
         });
@@ -1582,11 +1603,11 @@
         }
       });
       if (sum) {
-        if (column.summary == 'avg') {
+        if (column.summary == "avg") {
           sum = sum / (this.rowData.length || this.tableData.length || 1);
         }
         sum =
-          (sum * 1.0).toFixed(column.numberLength || 2).replace('.00', '') *
+          (sum * 1.0).toFixed(column.numberLength || 2).replace(".00", "") *
           1.0;
       }
       this.summaryData[this.summaryIndex[column.field]] = sum;
@@ -1613,7 +1634,7 @@
       }
       return (
         date1.valueOf() <
-        (typeof date2 == 'number' ? date2 : new Date(date2).valueOf())
+        (typeof date2 == "number" ? date2 : new Date(date2).valueOf())
       );
     },
     getDateOptions(date, item) {
@@ -1621,9 +1642,9 @@
       if ((!item.min && !item.max) || !date) {
         return false;
       }
-      if (item.min && item.min.indexOf(' ') == -1) {
+      if (item.min && item.min.indexOf(" ") == -1) {
         //涓嶈缃椂鍒嗙锛屽悗闈細鑷姩鍔犱笂 08:00
-        item.min = item.min + ' 00:00:000';
+        item.min = item.min + " 00:00:000";
       }
       return (
         this.compareDate(date, item.min) || !this.compareDate(date, item.max)
@@ -1631,19 +1652,19 @@
     },
     getDateFormat(column) {
       //瑙乭ttps://day.js.org/docs/zh-CN/display/format
-      return column.edit.type == 'date' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss';
+      return column.edit.type == "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss";
     },
     userSelect(selection, row) {
       this.selectRows = selection;
       if (!this.single) {
-        this.$emit('rowChange', { row, selection });
+        this.$emit("rowChange", { row, selection });
       }
     },
     isEmptyTag(row, column) {
-      if (!row[column.field] && row[column.field] != '0') {
-        return 'empty-tag';
+      if (!row[column.field] && row[column.field] != "0") {
+        return "empty-tag";
       }
-      return '';
+      return "";
     },
     filterChildrenColumn(children) {
       if (!children) {
@@ -1656,33 +1677,40 @@
     initColumnDisabled(row, column) {
       return column.getDisabled && column.getDisabled(row, column);
     },
-    showUpload(row,column){
-       this.fileInfo = (row[column.field] || '').split(",")
-                    .filter(x => { return x })
-                    .map(item => {
-                       return { path: item, name: "" };
-                    })
-      this.currentRow=row;
-      this.currentColumn=column;
-      if (this.currentColumn.edit.autoUpload===undefined) {
-        this.currentColumn.edit.autoUpload=true;
+    showUpload(row, column) {
+      this.fileInfo = (row[column.field] || "")
+        .split(",")
+        .filter((x) => {
+          return x;
+        })
+        .map((item) => {
+          return { path: item, name: "" };
+        });
+      this.currentRow = row;
+      this.currentColumn = column;
+      if (this.currentColumn.edit.autoUpload === undefined) {
+        this.currentColumn.edit.autoUpload = true;
       }
-      if (this.currentColumn.edit.multiple===undefined) {
-        this.currentColumn.edit.multiple=false;
+      if (this.currentColumn.edit.multiple === undefined) {
+        this.currentColumn.edit.multiple = false;
       }
 
-      if (this.currentColumn.edit.url===undefined) {
-          this.uploadUrl='api/'+(this.url||'').replace('/api','api').split('/')[1]+'/upload'
-      }else{
-        this.uploadUrl=this.currentColumn.edit.url;
+      if (this.currentColumn.edit.url === undefined) {
+        this.uploadUrl =
+          "api/" +
+          (this.url || "").replace("/api", "api").split("/")[1] +
+          "/upload";
+      } else {
+        this.uploadUrl = this.currentColumn.edit.url;
       }
-      this.uploadModel=true;
+      this.uploadModel = true;
     },
     uploadAfter(result, files) {
-      this.currentColumn.uploadAfter&&this.currentColumn.uploadAfter(result,files);
+      this.currentColumn.uploadAfter &&
+        this.currentColumn.uploadAfter(result, files);
       return true;
     },
-    saveUpload(){
+    saveUpload() {
       //鐢熸垚淇濆瓨鍚庤繑鍥炵殑璺緞
       let arr = this.fileInfo.map((x) => {
         if (x.path) {
@@ -1694,8 +1722,8 @@
       this.currentRow[this.currentColumn.field] = arr.join(",");
       this.uploadModel = false;
       return true;
-    }
-  }
+    },
+  },
 });
 </script>
 <style lang="less" scoped>

--
Gitblit v1.9.3