Parcourir la source

采购订单维护页面-详情-增加尾行合并

002390 il y a 1 an
Parent
commit
8c01ed30f9

+ 2 - 1
src/components/super-table/hide.vue

@@ -65,7 +65,7 @@
             <el-switch
               v-model="item.hidden"
               size="mini"
-              @change.stop="onDraggableChange"
+              @change="onDraggableChange"
             ></el-switch>
           </el-col>
         </el-draggable>
@@ -136,6 +136,7 @@ export default {
       return deepCopy(prop);
     },
     onDraggableChange() {
+      event.stopPropagation(); 
       this.$emit("change", this.columns);
     },
     useSubmit(){

+ 6 - 6
src/components/super-table/index.vue

@@ -323,20 +323,20 @@ export default {
 <template>
   <div class="el-super-table">
     <el-table
-      ref="superTable"
       border
       height="auto"
+      ref="superTable"
+      v-bind="$attrs"
+      v-on="$listeners"
       :row-key="rowKey"
       :data="innerValue"
+      :show-summary="showSummary"
+      :summary-method="showSummary ? getSummaries :''"
       :highlight-current-row="radio"
       @row-click="onRowClick"
-      @selection-change="onSelectionChange"
       @header-dragend="onWidth"
-      v-bind="$attrs"
-      v-on="$listeners"
+      @selection-change="onSelectionChange"
       style="flex: 1"
-      :show-summary="showSummary"
-      :summary-method="getSummaries"
     >
       <!-- 多选 -->
       <el-table-column

+ 585 - 0
src/components/super-table/index_copy.vue

@@ -0,0 +1,585 @@
+<script>
+export default {
+  name: "SuperTable",
+  props: {
+    // 数据
+    value: {
+      type: [Array],
+      require: true,
+    },
+    // 字典
+    dict: {
+      type: [Object],
+      require: true,
+    },
+    // 分页
+    page: {
+      type: [Object],
+      require: false,
+    },
+    // 模板
+    columns: {
+      type: [Array],
+      require: true,
+    },
+    // 是否显示序号
+    index: {
+      type: Boolean,
+      default: false,
+    },
+    // 是否显示单选
+    radio: {
+      type: Boolean,
+      default: false,
+    },
+    // 是否显示多选
+    checkbox: {
+      type: Boolean,
+      default: false,
+    },
+    // 是否显示分页
+    pagination: {
+      type: Boolean,
+      default: false,
+    },
+    // 是否列操作
+    convenitentOperation: {
+      type: Boolean,
+      default: false,
+    },
+    // 是否禁止选择
+    selectable: {
+      type: Function,
+      default: () => {},
+    },
+    //
+    storageKey: {
+      type: String,
+    },
+    showSummary:{
+      type:Boolean,
+      default:false,
+    },
+
+  },
+  components: {
+    ElDictTag: () => import("@/components/DictTag/index.vue"),
+    ElDraggable: () => import("@/components/draggable/index.vue"),
+    ElFilePreview: () => import("@/components/file-preview/index.vue"),
+    ElComputedInput: () => import("@/components/computed-input/index.vue"),
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+    ElPopoverMultipleSelectV2: () =>
+      import("@/components/popover-select-v2/multiple.vue"),
+    ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
+    ElPopoverTreeSelect: () =>
+      import("@/components/popover-tree-select/index.vue"),
+    ButtonHide: () => import("./hide.vue"),
+    ButtonFreeze: () => import("./freeze.vue"),
+    IconHide: () => import("./once/hide.vue"),
+    IconSort: () => import("./once/sort.vue"),
+    IconFreeze: () => import("./once/freeze.vue"),
+    IconFilter: () => import("./once/filters.vue"),
+  },
+  data() {
+    const { columns, storageKey } = this.$props;
+    const localColumns = localStorage.getItem(storageKey);
+    const innerColumns =
+      storageKey && localColumns
+        ? JSON.parse(localColumns)
+        : columns.map(({ item, attr }) => ({
+            attr,
+            item: { hidden: true, ...item },
+          }));
+    return {
+      innerColumns: innerColumns,
+      rowKey: "id",
+      // 选择
+      selectData: [],
+      selectState: false,
+      // 过滤
+      filterData: [],
+      filterState: false,
+    };
+  },
+  computed: {
+    innerValue: {
+      get() {
+        if (this.filterState) {
+          return this.filterData;
+        } else if (this.selectState) {
+          return this.selectData;
+        } else {
+          return this.$props.value;
+        }
+      },
+      set(value) {
+        this.$emit("input", value);
+      },
+    },
+    showColumns: {
+      get() {
+        return this.innerColumns.filter(({ item }) => item.hidden);
+      },
+      set() {},
+    },
+    filterRules: {
+      get() {
+        return Object.fromEntries(
+          this.innerColumns
+            .filter(({ item }) => item.filter && !!item.filter.length)
+            .map(({ item }) => [item.key, item.filter])
+        );
+      },
+      set() {},
+    },
+  },
+  watch: {
+    filterRules: {
+      handler: function (newValue) {
+        function multiFilter(array, filters) {
+          const filterKeys = Object.keys(filters);
+          // filters all elements passing the criteria
+          return array.filter((item) => {
+            // dynamically validate all filter criteria
+            return filterKeys.every((key) => {
+              //ignore when the filter is empty Anne
+              if (!filters[key].length) return true;
+              return !!~filters[key].indexOf(item[key]);
+            });
+          });
+        }
+        this.filterState = JSON.stringify(newValue) !== "{}";
+        this.filterData = multiFilter(this.$props.value, newValue);
+      },
+    },
+    value:{
+      handler: function (newValue) {
+        if(this.value.length > 0){
+          this.$refs.superTable&& this.$refs.superTable.clearSelection();
+        }
+      },
+      immediate: true,
+      deep:true
+    }
+  },
+  methods: {
+    //
+    onSelectionChange(value) {
+      this.selectData = value;
+      this.$emit("row-select", this.selectData);
+    },
+    //
+    onRowClick(row, column, event) {
+      const { radio, checkbox } = this.$props;
+      // 单选
+      if (radio) {
+        this.$emit("row-select", [row]);
+      }
+      // 多选
+      if (checkbox) {
+        this.$refs.superTable.toggleRowSelection(
+          this.innerValue.find((item) => item.id === row.id)
+        );
+      }
+    },
+    // 宽度
+    onWidth(newProp, oldProp, column) {
+      this.innerColumns = this.innerColumns.map(({ item, attr }) => ({
+        attr,
+        item: {
+          ...item,
+          width: item.key === column.property ? newProp : item.width,
+        },
+      }));
+      if (this.$props.storageKey) {
+        localStorage.setItem(
+          this.$props.storageKey,
+          JSON.stringify(this.innerColumns)
+        );
+      }
+    },
+    // 冻结
+    onHide(prop) {
+      this.$nextTick(() => {
+        this.$refs.superTable.doLayout();
+        if (this.$props.storageKey) {
+          localStorage.setItem(
+            this.$props.storageKey,
+            JSON.stringify(this.innerColumns)
+          );
+        }
+      });
+    },
+    // 排序
+    onSort(prop) {
+      const { key, sort } = prop;
+      this.$nextTick(() => {
+        this.$refs.superTable.sort(key, sort);
+        this.$refs.superTable.doLayout();
+        if (this.$props.storageKey) {
+          localStorage.setItem(
+            this.$props.storageKey,
+            JSON.stringify(this.innerColumns)
+          );
+        }
+      });
+    },
+    // 冻结
+    onFreeze() {
+      this.$nextTick(() => {
+        this.$refs.superTable.doLayout();
+        if (this.$props.storageKey) {
+          localStorage.setItem(
+            this.$props.storageKey,
+            JSON.stringify(this.innerColumns)
+          );
+        }
+      });
+    },
+    // 过滤
+    onFilter() {
+      this.$nextTick(() => {
+        this.$refs.superTable.doLayout();
+        if (this.$props.storageKey) {
+          localStorage.setItem(
+            this.$props.storageKey,
+            JSON.stringify(this.innerColumns)
+          );
+        }
+      });
+    },
+    onFilters(value) {
+      const {
+        item: { key },
+        attr: { dictName },
+      } = value;
+      let dataList = [];
+      const dict = this.dict.type[dictName];
+      dataList = Array.from(
+        new Set(this.innerValue.map((item) => item[key]).filter((item) => item))
+      ).map((item) => ({
+        text: dictName
+          ? (dict.find((dictItem) => dictItem.value == item) || {}).label
+          : item,
+        value: item,
+      }));
+      return dataList;
+    },
+    // 继承el-table的Method
+    extendMethod() {
+      const refMethod = Object.entries(this.$refs["superTable"]);
+      for (const [key, value] of refMethod) {
+        if (!(key.includes("$") || key.includes("_"))) {
+          this[key] = value;
+        }
+      }
+    },
+    getSummaries({ columns, data }){
+      
+      const means = [] // 合计
+      columns.forEach((column, columnIndex) => {
+          if (columnIndex === 0) {
+              means.push('合计')
+          } else {
+              const values = data.map(item => Number(item[column.property]));
+              
+              let sumColumn = this.showColumns.filter(({item,attr}) => attr.isSummary && item.key === column.property);
+
+              // 合计
+              // if (!values.every(value => isNaN(value))) {
+              if (sumColumn.length) {
+                  means[columnIndex] = values.reduce((prev, curr) => {
+                      const value = Number(curr);
+                      if (!isNaN(value)) {
+                          return prev + curr;
+                      } else {
+                          return prev;
+                      }
+                  }, 0);
+                  means[columnIndex] = means[columnIndex].toFixed(2); 
+              } else {
+                  means[columnIndex] = '';
+              }
+            }
+      })
+      // sums[index] = sums[index] && sums[index].toFixed(2); // 保留2位小数,解决小数合计列
+      return [means]
+			
+    }
+  },
+  created() {},
+  mounted() {
+    this.extendMethod();
+  },
+  updated() {
+    this.$nextTick(()=>{
+      this.$refs.superTable.doLayout();
+    })
+  },
+  destroyed() {},
+};
+</script>
+
+<template>
+  <div class="el-super-table">
+    <ux-grid 
+      border
+      row-key
+      use-virtual
+      show-overflow
+      keep-source
+      height="auto"
+      ref="superTable"
+      v-bind="$attrs"
+      v-on="$listeners"
+      :data="innerValue"
+      :show-summary="showSummary"
+      :summary-method="getSummaries"
+      :highlight-current-row="radio"
+      @row-click="onRowClick"
+      @header-dragend="onWidth"
+      @selection-change="onSelectionChange"
+      style="flex: 1"
+    >
+    <!-- <el-table
+      border
+      height="auto"
+      ref="superTable"
+      v-bind="$attrs"
+      v-on="$listeners"
+      :row-key="rowKey"
+      :data="innerValue"
+      :show-summary="showSummary"
+      :summary-method="getSummaries"
+      :highlight-current-row="radio"
+      @row-click="onRowClick"
+      @header-dragend="onWidth"
+      @selection-change="onSelectionChange"
+      style="flex: 1"
+    > -->
+      <!-- 多选 -->
+      <ux-table-column
+        v-if="checkbox"
+        :column-key="rowKey"
+        fixed
+        width="60"
+        align="center"
+        type="checkbox"
+        reserve-selection
+      >
+      </ux-table-column>
+      <!-- 序号 -->
+      <ux-table-column
+        v-if="index"
+        :resizable="false"
+        fixed
+        width="50"
+        title="序号"
+        align="center"
+        class="is-index"
+        type="index"
+      >
+        <!-- <template slot-scope="scope">
+          {{ scope.$index + 1 }}
+        </template> -->
+      </ux-table-column>
+      <ux-table-column
+        v-for="({ item, attr }, index) in showColumns"
+        :key="item.key + index"
+        :field="item.key"
+        :title="item.title"
+        :fixed="item.fixed"
+        :width="item.width || 200"
+        show-overflow-tooltip
+      >
+        <template slot="header" slot-scope="scope">
+          <template>
+            <span v-if="item.require" style="color: #ff4949">*</span>
+            <span
+              :style="{
+                color:
+                  item.sort ||
+                  item.fixed ||
+                  (item.filter && !!item.filter.length)
+                    ? '#1890ff'
+                    : '',
+              }"
+            >
+              {{ item.title }}
+            </span>
+            <template>
+              <icon-sort
+                v-if="item.sortabled"
+                v-model="item.sort"
+                @sort="onSort(item)"
+              ></icon-sort>
+              <icon-freeze
+                v-if="item.fixedabled"
+                v-model="item.fixed"
+                @freeze="onFreeze"
+              ></icon-freeze>
+              <icon-filter
+                v-if="item.filterabled"
+                v-model="item.filter"
+                :filters="onFilters({ item, attr })"
+                @filter="onFilter"
+              ></icon-filter>
+              <icon-hide
+                v-if="item.hiddenabled"
+                v-model="item.hidden"
+                @hide="onHide"
+              ></icon-hide>
+            </template>
+          </template>
+        </template>
+        <template slot-scope="scope">
+          <slot :name="item.key" v-bind="scope" :item="item" :attr="attr">
+            <template v-if="attr.is">
+              <component
+                v-if="attr.is === 'el-dict-tag'"
+                v-bind="attr"
+                :size="$attrs.size"
+                :value="scope.row[item.key]"
+                :options="dict.type[attr.dictName]"
+              ></component>
+              <component
+                v-else-if="attr.is === 'el-popover-select-v2'"
+                v-bind="attr"
+                v-model="scope.row[item.key]"
+                :title="item.title"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+              >
+              </component>
+              <component
+                v-else-if="attr.is === 'el-popover-multiple-select-v2'"
+                v-bind="attr"
+                v-model="scope.row[item.key]"
+                :title="item.title"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+              >
+              </component>
+              <component
+                v-else-if="attr.is === 'el-select'"
+                v-bind="attr"
+                v-model="scope.row[item.key]"
+                :size="$attrs.size"
+              >
+                <template>
+                  <el-option
+                    v-for="item in dict.type[attr.dictName]"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </template>
+              </component>
+              <component
+                v-else
+                v-bind="attr"
+                v-model="scope.row[item.key]"
+                :size="$attrs.size"
+                style="width: 100%"
+              >
+              </component
+            ></template>
+            <template v-else>
+              <component v-if="attr.formatter" is="span">{{
+                attr.formatter(scope.row)
+              }}</component>
+              <component v-else is="span">{{
+                scope.row[item.key] || "--"
+              }}</component>
+            </template>
+          </slot>
+        </template>
+      </ux-table-column>
+      <slot></slot>
+    <!-- </el-table> -->
+    </ux-grid>
+    <div
+      style="
+        height: 50px;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+      "
+      :style="{
+        height: checkbox || pagination ? '50px' : '0px',
+      }"
+    >
+      <div class="mr-4">
+        <!-- <template v-if="checkbox">
+          <el-button
+            v-if="selectState"
+            size="mini"
+            @click="selectState = !selectState"
+          >
+            所有列
+          </el-button>
+          <el-button
+            v-else
+            :disabled="!selectData.length"
+            size="mini"
+            @click="selectState = !selectState"
+          >
+            选择列
+            {{ selectData.length ? ` :${selectData.length}` : "" }}
+          </el-button>
+        </template> -->
+        <template v-if="convenitentOperation">
+          <button-hide v-model="innerColumns" @change="onHide"></button-hide>
+        </template>
+      </div>
+      <pagination
+        v-if="pagination"
+        v-show="!selectState"
+        :total="page.total"
+        :page.sync="page.pageNum"
+        :limit.sync="page.pageSize"
+        @pagination="$emit('pagination', { ...$event })"
+        style="height: 32px; padding: 0 !important; flex: 1; overflow-x: auto"
+      />
+    </div>
+  </div>
+</template>
+
+<style lang="scss" scoped>
+.el-super-table {
+  position: relative;
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  overflow: auto;
+}
+::v-deep.el-super-table .el-table__header .cell {
+  word-break: keep-all;
+  white-space: nowrap;
+  .icon-sort {
+    display: none;
+  }
+  &:hover .icon-sort {
+    display: inline-block;
+  }
+  .icon-freeze {
+    display: none;
+  }
+  &:hover .icon-freeze {
+    display: inline-block;
+  }
+  .icon-filter {
+    display: none;
+  }
+  &:hover .icon-filter {
+    display: inline-block;
+  }
+  .icon-hide {
+    display: none;
+  }
+  &:hover .icon-hide {
+    display: inline-block;
+  }
+}
+</style>

+ 119 - 92
src/views/purchase/purchase-order/add/index.vue

@@ -59,6 +59,7 @@ export default {
       tabName: "puOrderItemList",
       isCopy:false,
       tableData:[],  //虚拟滚动加载显示的数据
+      rowHeight: 60,
     };
   },
   computed: {
@@ -278,18 +279,55 @@ export default {
       // prop.push(initParams(arr, "key", "value"));
     },
     // 删行
-    async delTableRow(prop, index) {
+    // 删除行
+    async delTableRow(prop, row, name) {
+
+      let delNo = name  === 'puOrderItemList' ? 'rowNo' :'rowno';
+
+      if(prop.length === 1){
+        this.$alert('订单行不允许为空', '提示', {
+          confirmButtonText: '确定',
+          callback: action => {
+            // this.$message({
+            //   type: 'info',
+            //   message: `action: ${ action }`
+            // });
+          }
+        });
+      }else{
+        for (const key in this.params) {
+        
 
-     
-      for (const key in this.params) {
-        // if (Array.isArray(this.params[key])) {
-        if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
-          this.params[key].splice(index, 1);
+          if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
+
+            this.params[key].forEach((item,index) =>{
+
+              let flag = key === 'puOrderItemList' ? 'rowNo' :'rowno';
+
+              // if(item.id && item.id === row.id){
+              //   console.log('删除已有ID的');
+              //   item['delFlag'] = '2';
+              // }
+
+              if(item[flag] && item[flag] === row[delNo]){
+
+                item.id ? (item['delFlag'] = '2'):
+                this.params[key].splice(index, 1);
+              }
+
+            })
+
+            // this.params[key][index].id ? 
+            //   (this.params[key][index]['delFlag'] = '2') :
+            //   this.params[key].splice(index, 1);
+
+            
+          }
         }
-      }
 
-      await this.handleGetPrice();
-      // prop.splice(index, 1);
+
+        await this.handleGetPrice();
+      }
     },
     // 同步子表物料
     handleSynchronousMaterial(tableOne, tableTwo) {
@@ -517,7 +555,7 @@ export default {
 
 
     // 子表参照改变之后
-   async handleTabReferChange(val,  type, source) {
+    async handleTabReferChange(val,  type, source) {
 
       // 触发物料参照询价 
       if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {
@@ -566,6 +604,8 @@ export default {
         }
       }
 
+      
+
     },
 
     // 子表下拉框改变
@@ -727,41 +767,39 @@ export default {
     //   return role;
     // },
     getSummaries({ columns, data }){
-      // const  = param;
-      const sums = [];
+      
+      const means = [] // 合计
       let { tabColumns, tabName } = this;
-
-      columns.forEach((column, index) => {
-
-				if (index === 0) {
-				   sums[index] = '合计';
-				   return;
-				}
-
-				const values = data.map(item => Number(item[column.property]));
-       
-        let sumColumn = tabColumns.find(tab => tab.key === tabName).tableColumns.filter(({key,isSummary}) => {
-
-          if(isSummary && key === column.property){
-
-            return {key,isSummary}
-          }
-        });
-        
-        if (sumColumn.length) {
-          sums[index] = values.reduce((prev, curr) => {
-            const value = Number(curr);
-            if (!isNaN(value)) {
-              return prev + curr;
-            } else {
-              return '';
+      columns.forEach((column, columnIndex) => {
+          if (columnIndex === 0) {
+              means.push('合计')
+          } else {
+              const values = data.map(item => Number(item[column.property]));
+              
+              let sumColumn = tabColumns.find(tab => tab.key === tabName).tableColumns.filter(({key,isSummary}) => isSummary && key === column.property);
+
+              // 合计
+              // if (!values.every(value => isNaN(value))) {
+              if (sumColumn.length) {
+                  means[columnIndex] = values.reduce((prev, curr) => {
+                      const value = Number(curr);
+                      if (!isNaN(value)) {
+                          return prev + curr;
+                      } else {
+                          return prev;
+                      }
+                  }, 0);
+                  means[columnIndex] = means[columnIndex].toFixed(2); 
+              } else {
+                  means[columnIndex] = '';
+              }
             }
-          }, 0);
-          sums[index] = sums[index] && sums[index].toFixed(2); // 保留2位小数,解决小数合计列
-          }
-			});
-			return sums;
+      })
+      // sums[index] = sums[index] && sums[index].toFixed(2); // 保留2位小数,解决小数合计列
+      return [means]
+			
     }
+    
 
   },
   created() {
@@ -965,43 +1003,46 @@ export default {
             :name="column.key"
           >
 
-          <virtual-scroll 
+          <!-- <virtual-scroll 
             :data="params[column.key]" 
             :item-size="53" 
             :key-prop="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'" 
             @change="(virtualList) => tableData = virtualList" 
             :virtualized="true"
           >
-      <!-- row-key绑定列唯一值,height一定要设置否则会滚动条滚动位置不对且数据滚动全部加载完后会出现白板-->
-            <template slot-scope="{ headerCellFixedStyle, cellFixedStyle }">
+              <template slot-scope="{ headerCellFixedStyle, cellFixedStyle }"> -->
 
-              <el-table 
+                <!-- :headerCellStyle="headerCellFixedStyle"
+                :cellStyle="cellFixedStyle"
+                  -->
+              <ux-grid 
                 border
+                use-virtual
+                show-summary
+                show-overflow
+                keep-source
                 :ref="column.key"
-                :row-key="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'" 
-                :data="tableData" 
-                style="width: 100%"
-                :headerCellStyle="headerCellFixedStyle"
-                :cellStyle="cellFixedStyle"
                 :height="tabHeight"
-              >
-                <!-- 
-                  :height="tabHeight"
-                   max-height="500px"
-                show-summary
+                style="width: 100%"
+                :data="params[column.key]" 
                 :summary-method="getSummaries"
-                -->
+                >
+                <!-- :edit-config="{trigger: 'click', mode: 'cell'}" -->
+                <!-- :row-height="rowHeight" -->
+                <!-- :row-key="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'" -->
+                
                 <template slot="empty">
-                  <el-empty description="暂无数据"></el-empty>
+                  暂无数据
                 </template>
 
-                <el-table-column
+                <ux-table-column
                   v-for="(cColumn, cIndex) in column.tableColumns"
                   :key="cIndex"
-                  :label="cColumn.title"
+                  :title="cColumn.title"
                   :width="cColumn.width || 80"
-                  :prop="cColumn.key"
-                >
+                  :field="cColumn.key"
+                  >
+                  <!-- :edit-render="!cColumn.disabled" -->
                   <template slot="header" slot-scope="scope">
                     <span v-if="cColumn.require" style="color: #ff4949">*</span>
                     <span>
@@ -1009,12 +1050,9 @@ export default {
                     </span>
                   </template>
   
+                  <!-- v-slot:edit="scope" -->
                   <template slot-scope="scope">
-                    <el-form-item 
-                      label-width="0" 
-                      >
-                      <!-- :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
-                      :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }" -->
+                    <el-form-item label-width="0">
                       <el-tag v-if="cColumn.key === 'index'" >
                         {{ scope.$index + 1 }}
                       </el-tag>
@@ -1088,40 +1126,23 @@ export default {
                       ></el-checkbox>
                     </el-form-item>
                   </template>
-                </el-table-column>
+
+                </ux-table-column>
   
-                <VirtualColumn
-                  vfixed="right"
-                  label="操作"
-                  width="80">
+                <ux-table-column fixed="right" label="操作" width="80">
                   <template slot-scope="scope">
                     <el-button
-                      @click.native.prevent="
-                        delTableRow(params[tabName], scope.$index)
-                      "
+                      @click.native.prevent="delTableRow(params[tabName],  scope.row,tabName)"
                       type="text"
                       size="small"
                     >
                       删行
                     </el-button>
                   </template>
-                </VirtualColumn>
-                <!-- <el-table-column fixed="right" label="操作" width="80">
-                  <template slot-scope="scope">
-                    <el-button
-                      @click.native.prevent="
-                        delTableRow(params[tabName], scope.$index)
-                      "
-                      type="text"
-                      size="small"
-                    >
-                      删行
-                    </el-button>
-                  </template>
-                </el-table-column> -->
-              </el-table>
-            </template>
-          </virtual-scroll>
+                </ux-table-column>
+              </ux-grid>
+            <!-- </template>
+          </virtual-scroll> -->
 
 
             
@@ -1144,4 +1165,10 @@ export default {
   </el-drawer>
 </template>
 
+<style scoped>
+::v-deep .singleTable .el-form-item{
+  margin-bottom: 0px;
+}
+</style>
+
 

+ 69 - 60
src/views/purchase/purchase-order/edit/index.vue

@@ -736,39 +736,38 @@ export default {
 
       this.download('/pu/order/downloadFailData',{}, `物料信息模板${new Date().getTime()}.xlsx`);
     },
-    getSummaries(param){
-        const { columns, data } = param;
-				const sums = [];
-        let { tabColumns, tabName } = this;
-
-				columns.forEach((column, index) => {
-
-				if (index === 0) {
-				   sums[index] = '合计';
-				   return;
-				}
-
-				const values = data.map(item => Number(item[column.property]));
-       
-        let sumColumn = tabColumns.find(tab => tab.key === tabName).tableColumns.filter(({key,isSummary}) => isSummary && key === column.property);
-        
-        if (sumColumn.length) {
-          sums[index] = values.reduce((prev, curr) => {
-            const value = Number(curr);
-            if (!isNaN(value)) {
-              return prev + curr;
-            } else {
-              return '';
-            }
-          }, 0);
-          sums[index] = sums[index].toFixed(2); // 保留2位小数,解决小数合计列
-          }
-				});
-				return sums;
-
-        // return 0
-
+    getSummaries({ columns, data }){
       
+      const means = [] // 合计
+      let { tabColumns, tabName } = this;
+      columns.forEach((column, columnIndex) => {
+          if (columnIndex === 0) {
+              means.push('合计')
+          } else {
+              const values = data.map(item => Number(item[column.property]));
+              
+              let sumColumn = tabColumns.find(tab => tab.key === tabName).tableColumns.filter(({key,isSummary}) => isSummary && key === column.property);
+
+              // 合计
+              // if (!values.every(value => isNaN(value))) {
+              if (sumColumn.length) {
+                  means[columnIndex] = values.reduce((prev, curr) => {
+                      const value = Number(curr);
+                      if (!isNaN(value)) {
+                          return prev + curr;
+                      } else {
+                          return prev;
+                      }
+                  }, 0);
+                  means[columnIndex] = means[columnIndex].toFixed(2); 
+              } else {
+                  means[columnIndex] = '';
+              }
+            }
+      })
+      // sums[index] = sums[index] && sums[index].toFixed(2); // 保留2位小数,解决小数合计列
+      return [means]
+			
     }
 
   },
@@ -938,16 +937,16 @@ export default {
             :name="column.key"
             >
 
-            <virtual-scroll 
+            <!-- <virtual-scroll 
               :data="params[column.key].filter(item => item.delFlag === '0')" 
               :item-size="53" 
               :key-prop="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'" 
               @change="(virtualList) => tableData = virtualList" 
               :virtualized="true"
             >
-              <template slot-scope="{ headerCellFixedStyle, cellFixedStyle }">
+              <template slot-scope="{ headerCellFixedStyle, cellFixedStyle }"> -->
               <!-- row-key绑定列唯一值,height一定要设置否则会滚动条滚动位置不对且数据滚动全部加载完后会出现白板-->
-                <el-table 
+                <!-- <el-table 
                   border
                   :ref="column.key"
                   :data="tableData" 
@@ -955,26 +954,35 @@ export default {
                   :headerCellStyle="headerCellFixedStyle"
                   :cellStyle="cellFixedStyle"
                   :height="tabHeight"
-                >
-                <!-- max-height="500px"
+                > -->
+                <ux-grid 
+                  border
+                  use-virtual
                   show-summary
-                  :summary-method="getSummaries" -->
-                  <virtual-column label="序号" type="index">
-                    <template slot-scope="scope">
-                      {{ scope.$index + 1 }}
-                    </template>
-                  </virtual-column>
+                  show-overflow
+                  keep-source
+                  :ref="column.key"
+                  :height="tabHeight"
+                  style="width: 100%"
+                  :data="params[column.key].filter(item => item.delFlag === '0')" 
+                  :summary-method="getSummaries"
+                  >
+                  <ux-table-column title="序号" type="index" width="60">
+                    <!-- <template slot-scope="scope">
+                      {{ scope.row.$index + 1 }}
+                    </template> -->
+                  </ux-table-column>
                   <!-- <el-table-column label="序号">
                     <template slot-scope="scope">
                       {{ scope.$index + 1 }}
                     </template>
                   </el-table-column> -->
-                  <el-table-column 
+                  <ux-table-column 
                     v-for="(cColumn, cIndex) in column.tableColumns" 
                     :key="cIndex" 
-                    :prop="cColumn.key"
-                    :label="cColumn.title" 
-                    :width="cColumn.width"
+                    :field="cColumn.key"
+                    :title="cColumn.title" 
+                    :width="cColumn.width || 80"
                     >
                     <template slot="header" slot-scope="scope">
                       <span v-if="cColumn.require" style="color: #ff4949">*</span>
@@ -984,12 +992,7 @@ export default {
                     </template>
                     <template slot-scope="scope">
 
-                      <el-form-item 
-                        label-width="0" 
-                        >
-                        <!-- :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
-                        :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }" -->
-
+                      <el-form-item label-width="0">
                       <span v-if="!cColumn.inputType">
                         {{ scope.row[cColumn.key] }}
                       </span>
@@ -1057,15 +1060,15 @@ export default {
 
                     </el-form-item>
                     </template>
-                  </el-table-column>
+                  </ux-table-column>
 
 
                   <!-- 修订:不可删除、增行
                   编辑:自制:可删可增 -->
                   <!-- v-if="!handleIsRevise()" -->
-                  <VirtualColumn
+                  <ux-table-column
                     v-if="!handleIsRevise()"
-                    vfixed="right"
+                    fixed="right"
                     label="操作"
                     width="120"
                   >
@@ -1077,11 +1080,11 @@ export default {
                         > 删行
                       </el-button>
                     </template>
-                  </VirtualColumn>
+                  </ux-table-column>
                   
-                </el-table>
-              </template>
-          </virtual-scroll>
+                </ux-grid>
+              <!-- </template>
+          </virtual-scroll> -->
            
           </el-tab-pane>
         </el-tabs>
@@ -1100,3 +1103,9 @@ export default {
     </el-form>
   </el-drawer> 
 </template>
+
+<style scoped>
+::v-deep .singleTable .el-form-item{
+  margin-bottom: 0px;
+}
+</style>

+ 58 - 58
src/views/purchase/purchase-order/see/index.vue

@@ -159,39 +159,38 @@ export default {
     beforeOpen() { 
       
     },
-    getSummaries(param){
-        const { columns, data } = param;
-				const sums = [];
-        let { tabColumns, tabName } = this;
-
-				columns.forEach((column, index) => {
-
-				if (index === 0) {
-				   sums[index] = '合计';
-				   return;
-				}
-
-				const values = data.map(item => Number(item[column.property]));
-       
-        let sumColumn = tabColumns.find(tab => tab.key === tabName).tableColumns.filter(({key,isSummary}) => isSummary && key === column.property);
-        
-        if (sumColumn.length) {
-          sums[index] = values.reduce((prev, curr) => {
-            const value = Number(curr);
-            if (!isNaN(value)) {
-              return prev + curr;
-            } else {
-              return '';
-            }
-          }, 0);
-          sums[index] = sums[index].toFixed(2); // 保留2位小数,解决小数合计列
-          }
-				});
-				return sums;
-
-        // return 0
-
+    getSummaries({ columns, data }){
       
+      const means = [] // 合计
+      let { tabColumns, tabName } = this;
+      columns.forEach((column, columnIndex) => {
+          if (columnIndex === 0) {
+              means.push('合计')
+          } else {
+              const values = data.map(item => Number(item[column.property]));
+              
+              let sumColumn = tabColumns.find(tab => tab.key === tabName).tableColumns.filter(({key,isSummary}) => isSummary && key === column.property);
+
+              // 合计
+              // if (!values.every(value => isNaN(value))) {
+              if (sumColumn.length) {
+                  means[columnIndex] = values.reduce((prev, curr) => {
+                      const value = Number(curr);
+                      if (!isNaN(value)) {
+                          return prev + curr;
+                      } else {
+                          return prev;
+                      }
+                  }, 0);
+                  means[columnIndex] = means[columnIndex].toFixed(2); 
+              } else {
+                  means[columnIndex] = '';
+              }
+            }
+      })
+      // sums[index] = sums[index] && sums[index].toFixed(2); // 保留2位小数,解决小数合计列
+      return [means]
+			
     }
   },
   created() { 
@@ -376,39 +375,34 @@ export default {
             :name="column.key"
           >
 
-            <virtual-scroll 
+            <!-- <virtual-scroll 
               :data="params[column.key].filter(item => item.delFlag === '0')" 
               :item-size="53" 
               :key-prop="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'" 
               @change="(virtualList) => tableData = virtualList" 
               :virtualized="true"
             >
-            <!-- row-key绑定列唯一值,height一定要设置否则会滚动条滚动位置不对且数据滚动全部加载完后会出现白板-->
-              <template slot-scope="{ headerCellFixedStyle, cellFixedStyle }">
-                <el-table 
+              <template slot-scope="{ headerCellFixedStyle, cellFixedStyle }"> -->
+                <ux-grid 
                   border
-                  :data="tableData" 
-                  style="width: 100%"  
-                  :row-key="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'"
-                  :headerCellStyle="headerCellFixedStyle"
-                  :cellStyle="cellFixedStyle"
+                  use-virtual
+                  show-summary
+                  show-overflow
+                  keep-source
+                  :ref="column.key"
                   :height="tabHeight"
+                  style="width: 100%"
+                  :data="params[column.key].filter(item => item.delFlag === '0')" 
+                  :summary-method="getSummaries"
                 >
-                <!-- 
-                  max-height="500px"
-                  show-summary
-                  :summary-method="getSummaries" -->
-                  <el-table-column label="序号">
-                    <template slot-scope="scope">
-                      {{ scope.$index + 1 }}
-                    </template>
-                  </el-table-column>
-                  <el-table-column 
+                
+                  <ux-table-column title="序号" type="index" width="60"></ux-table-column>
+                  <ux-table-column 
                     v-for="(cColumn, cIndex) in column.tableColumns" 
                     :key="cIndex" 
-                    :prop="cColumn.key"
-                    :label="cColumn.title" 
-                    :width="cColumn.width"
+                    :field="cColumn.key"
+                    :title="cColumn.title" 
+                    :width="cColumn.width || 80"
                   >
                     <template slot="header" slot-scope="scope">
                       <span v-if="cColumn.require" style="color: #ff4949">*</span>
@@ -483,10 +477,10 @@ export default {
                       </el-form-item>
                       
                     </template>
-                  </el-table-column>
-                </el-table>
-              </template>
-          </virtual-scroll>
+                  </ux-table-column>
+                </ux-grid>
+              <!-- </template>
+          </virtual-scroll> -->
             
           </el-tab-pane>
         </el-tabs>
@@ -495,3 +489,9 @@ export default {
     </el-form>
   </el-drawer>
 </template>
+
+<style scoped>
+::v-deep .singleTable .el-form-item{
+  margin-bottom: 0px;
+}
+</style>

+ 4 - 1
src/views/purchase/task/xie-yi-zhi-cai/index.vue

@@ -280,6 +280,9 @@ export default {
   },
   created() {},
   mounted() {},
+  updated() {
+    this.$refs.superTable && this.$refs.superTable[0].doLayout();
+  },
   destroyed() {},
 };
 </script>
@@ -362,7 +365,7 @@ export default {
             </el-descriptions-item>
             
           </el-descriptions>
-  
+          
           <el-super-table
             ref="superTable"
             v-model="item.orderPriceVos"