lilei 2 년 전
부모
커밋
5f00d7bb2f
6개의 변경된 파일71개의 추가작업 그리고 44개의 파일을 삭제
  1. 1 1
      package.json
  2. 1 1
      src/components/index.less
  3. 22 1
      src/components/newThem.less
  4. 2 0
      src/config/router.config.js
  5. 4 1
      src/main.js
  6. 41 40
      src/views/inventoryManagement/intelligentReplenishment/import.vue

+ 1 - 1
package.json

@@ -44,7 +44,7 @@
     "wangeditor": "^3.1.1",
     "@jiaminghi/data-view": "^2.10.0",
     "echarts": "^5.4.0",
-    "vue-easytable": "^2.21.5",
+    "vue-easytable": "^2.24.0",
     "vue-tv-focusable": "^2.0.1"
   },
   "devDependencies": {

+ 1 - 1
src/components/index.less

@@ -1,5 +1,5 @@
 @import '~ant-design-vue/dist/antd.less'; // 引入官方提供的 less 样式入口文件
-// @import "~ant-design-vue/lib/style/index";
+@import '~vue-easytable/packages/theme-default/index.less';
 @import './newThem.less'; // 用于覆盖上面定义的变量
 // The prefix to use on all css classes from ant-pro.
 @ant-pro-prefix             : ant-pro;

+ 22 - 1
src/components/newThem.less

@@ -7,4 +7,25 @@
 @collapse-header-padding: 6px 8px;
 @table-padding-vertical: 5px;
 @table-padding-horizontal: 5px;
-@input-disabled-bg: #fdfdfd;
+@input-disabled-bg: #fdfdfd;
+
+// vue-easytable new style
+@ve-default-font-size: 12px;
+@ve-table-head-row-height: 30px;
+@ve-table-body-row-height: 30px;
+@ve-table-foot-row-height: 30px;
+@ve-table-head-row-td-padding: 5px;
+@ve-table-body-row-td-padding: 5px;
+@ve-table-body-row-expand-content-padding: 0 5px;
+@ve-table-foot-row-td-padding: 5px;
+@ve-table-border-color: #ddd;
+@ve-table-column-fixed-border-color: #aaa;
+@ve-table-body-row-hover-background-color: color(~`colorPalette('@{primary-color}', 0.5) `);
+@ve-table-body-row-highlight-background-color: color(~`colorPalette('@{primary-color}', 1) `);
+ 
+.ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content{
+    // border-bottom: 1px solid #ddd;
+}
+.ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content thead.ve-table-header tr.ve-table-header-tr th.ve-table-header-th{
+    font-weight: 900;
+}

+ 2 - 0
src/config/router.config.js

@@ -1321,6 +1321,7 @@ export const asyncRouterMap = [
                 meta: {
                   title: '基础信息设置',
                   icon: 'monitor',
+                  replaceTab: true,
                   hidden: true
                 }
               },
@@ -1331,6 +1332,7 @@ export const asyncRouterMap = [
                 meta: {
                   title: '确认导入',
                   icon: 'monitor',
+                  replaceTab: true,
                   hidden: true
                 }
               },

+ 4 - 1
src/main.js

@@ -13,12 +13,15 @@ import {loading,borderBox13,digitalFlop,capsuleChart,borderBox8,borderBox12,bord
 import Echart from './bigScreenComponents/echart/index.vue'
 import ItemWrap from './bigScreenComponents/item-wrap/item-wrap.vue'
 import Reacquire from './bigScreenComponents/reacquire/reacquire.vue'
-import "vue-easytable/libs/theme-default/index.css";
 // 自定义组件
 Vue.component("Echart",Echart)
 Vue.component("ItemWrap",ItemWrap)
 Vue.component("Reacquire",Reacquire)
 
+// 引入组件库
+import VueEasytable from "vue-easytable";
+Vue.use(VueEasytable);
+
 // datav组件
 Vue.use(loading)
 Vue.use(borderBox13)

+ 41 - 40
src/views/inventoryManagement/intelligentReplenishment/import.vue

@@ -7,22 +7,21 @@
           <a id="intelligentReplenishmentImport-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
         </template>
       </a-page-header>
-      <a-card :bordered="false" class="intelligentReplenishmentImport-cont">
+      <a-card size="small" :bordered="false" class="intelligentReplenishmentImport-cont">
         <div>
           <p class="total">共 <span>{{ listData.length }}</span> 条数据,红色字体表示数据不符合规范,请返回上一步修改文件后重新上传</p>
-          <s-table
-            class="sTable"
-            ref="table"
-            size="small"
-            :rowKey="(record) => record.id"
-            :columns="columns"
-            :data="loadData"
-            :scroll="{ x: 1440 }"
-            :rowClassName="(record, index) => record.cost ? 'redBg-row':''"
-            :showPagination="false"
-            :defaultLoadData="false"
-            bordered>
-          </s-table>
+          
+        <ve-table
+              border-y
+              :border-around="false"
+              :max-height="tableHeight"
+              :row-style-option="{clickHighlight: true}"
+              :cellSelectionOption="{enable: false}"
+              :virtual-scroll-option="{enable: true}"
+              :columns="columns"
+              :table-data="listData"
+              row-key-field-name="id"
+            />
           <div class="btn-cont">
             <a-button
               type="primary"
@@ -64,32 +63,18 @@ export default {
   data () {
     return {
       spinning: false,
+      tableHeight: 500,
       columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '产品状态', dataIndex: 'productStateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '订货周期(天)', dataIndex: 'cycle', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '是否淘汰', dataIndex: 'eliminateText', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '淘汰描述', dataIndex: 'eliminateDesc', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '备注', dataIndex: 'remark', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '错误原因', dataIndex: 'errorDesc', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+        { title: '序号', field: 'no',key: "a", width: 80, align: 'center', fixed: 'left',operationColumn: false },
+        { title: '产品编码', field: 'productCode',key: "b", width: 220, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
+        { title: '产品名称', field: 'productName',key: "c", align: 'center',operationColumn: false , ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+        { title: '产品状态', field: 'productStateDictValue',key: "d", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
+        { title: '订货周期(天)', field: 'cycle',key: "e", width: 120, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || row[column.field] == 0 ? row[column.field] : '--'}},
+        { title: '是否淘汰', field: 'eliminateText',key: "f", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+        { title: '淘汰描述', field: 'eliminateDesc',key: "g", width: 200, align: 'center',operationColumn: false, ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+        { title: '备注', field: 'remark', width: 200,key: "h", align: 'center',operationColumn: false, ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
+        { title: '错误原因', field: 'errorDesc',key: "i", width: 200, align: 'center',operationColumn: false, ellipsis: { showTitle: true } ,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}}
       ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        return predictProductInfoGoods({ path: JSON.parse(this.$cookies.get('REPLENISHMENT_PATH')) }).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = i + 1
-              this.errorFlag.push(data.list[i].errorFlag)
-            }
-            this.listData = data.list
-          }
-          return data
-        })
-      },
       listData: [],
       errorFlag: []
     }
@@ -103,6 +88,22 @@ export default {
     handleBackSet () {
       this.$router.push({ path: `/inventoryManagement/intelligentReplenishment/set` })
     },
+    getTable(){
+      this.tableHeight = window.innerHeight - 325
+      this.spinning = true
+      predictProductInfoGoods({ path: JSON.parse(this.$cookies.get('REPLENISHMENT_PATH')) }).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = i + 1
+              this.errorFlag.push(data.list[i].errorFlag)
+            }
+            this.listData = data.list
+          }
+          this.spinning = false
+        })
+    },
     // 确认导入
     handleSubmit () {
       const _this = this
@@ -129,13 +130,13 @@ export default {
   },
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-      this.$refs.table.refresh(true)
+      this.getTable()
     }
   },
   activated () {
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
-      this.$refs.table.refresh(true)
+      this.getTable()
     }
   }
 }