Преглед изворни кода

Merge branch 'dev' into 'purchaseDev'

Dev

See merge request new-business/drp-web!218
黄梓星 пре 1 година
родитељ
комит
3a6ab6a1fa
2 измењених фајлова са 434 додато и 400 уклоњено
  1. 25 14
      src/api/material/basic.js
  2. 409 386
      src/views/material/basicFile/index.vue

+ 25 - 14
src/api/material/basic.js

@@ -42,7 +42,7 @@ const medcineDetails = (id) => {
   })
 }
 
-// 根据物料id获取医药行业信息详细信息  
+// 根据物料id获取医药行业信息详细信息
 const medcineDetailsInfo = (id) => {
   return request({
     url: `/system/medcine/detailsInfo/${id}`,
@@ -69,7 +69,7 @@ const costList = (data) => {
   })
 }
 
-// 成本信息详情 
+// 成本信息详情
 const costDetails = (id) => {
   return request({
     url: `/system/cost/details/${id}`,
@@ -144,7 +144,7 @@ const planList = (data) => {
   })
 }
 
-// 查询计划信息详情 
+// 查询计划信息详情
 const planDetails = (id) => {
   return request({
     url: `/system/plan/details/${id}`,
@@ -153,7 +153,7 @@ const planDetails = (id) => {
   })
 }
 
-// 获取利润中心信息列表 
+// 获取利润中心信息列表
 const centerList = (data) => {
   return request({
     url: `/system/center/list`,
@@ -162,7 +162,7 @@ const centerList = (data) => {
   })
 }
 
-// 获取利润中心详细信息 
+// 获取利润中心详细信息
 const centerDetails = (id) => {
   return request({
     url: `/system/center/details/${id}`,
@@ -171,7 +171,7 @@ const centerDetails = (id) => {
   })
 }
 
-// 获取采购信息列表  
+// 获取采购信息列表
 const purchaseList = (data) => {
   return request({
     url: `/system/purchase/list`,
@@ -180,7 +180,7 @@ const purchaseList = (data) => {
   })
 }
 
-// 获取采购详细信息 
+// 获取采购详细信息
 const purchaseDetails = (id) => {
   return request({
     url: `/system/purchase/details/${id}`,
@@ -189,7 +189,7 @@ const purchaseDetails = (id) => {
   })
 }
 
-// 获取库存信息列表  
+// 获取库存信息列表
 const inventoryList = (data) => {
   return request({
     url: `/system/inventory/list`,
@@ -198,7 +198,7 @@ const inventoryList = (data) => {
   })
 }
 
-// 获取库存详细信息 
+// 获取库存详细信息
 const inventoryDetails = (id) => {
   return request({
     url: `/system/inventory/details/${id}`,
@@ -232,7 +232,7 @@ const materialEdit = (data) => {
   })
 }
 
-// 修改医药行业信息 /dev-api/drp-admin/system/medcine/edit   
+// 修改医药行业信息 /dev-api/drp-admin/system/medcine/edit
 const medcineEdit = (data) => {
   return request({
     url: `/system/medcine/edit `,
@@ -278,7 +278,7 @@ const medcineitemBatchSave = (data) => {
   })
 }
 
-// 修改财务信息 /dev-api/drp-admin/system/finance/edit 
+// 修改财务信息 /dev-api/drp-admin/system/finance/edit
 const financeEdit = (data) => {
   return request({
     url: `/system/finance/edit `,
@@ -432,7 +432,15 @@ const saveVersions = (data) => {
     data,
   })
 }
-
+// 物料导出
+export function exportMartial(data) {
+  return request({
+    url: `/system/material/downloadFailData`,
+    method: 'post',
+    data: data,
+    responseType: 'blob'
+  })
+}
 export default {
   // 查询
   materialList,
@@ -485,5 +493,8 @@ export default {
   delPurchase,
   // 维护新版本
   versions,
-  saveVersions
-}
+  saveVersions,
+
+  //导出
+  exportMartial
+}

+ 409 - 386
src/views/material/basicFile/index.vue

@@ -1,6 +1,7 @@
 <!-- 物料信息基础档案 -->
+<script src="../../../main.js"></script>
 <template>
-  <div class="material-basic">
+  <div class="material-basic" v-loading="failLoad">
 
     <!-- 操作栏 -->
     <div>
@@ -39,7 +40,7 @@
         <el-col :span="1.5">
           <el-button-group>
             <el-button size="small" @click="handleIsInvoke" :disabled="checkedList.length != 1"
-              v-hasPermi="['system:material:add']">
+                       v-hasPermi="['system:material:add']">
               <!-- 0:启用  2:停用 -->
               {{ handleJudgeIsUsing() ? '停用' : '启用' }}
             </el-button>
@@ -95,26 +96,26 @@
     <!-- 主体列表 -->
     <el-card class="material-list" v-loading="loading">
       <el-table :data="taskList" ref="materialTable" @cell-dblclick="handledbClick" :row-key="getRowKey"
-        @selection-change="handleSelectionChange" @select="handleSelect" @select-all="handleSelectAll">
+                @selection-change="handleSelectionChange" @select="handleSelect" @select-all="handleSelectAll">
         <!--  -->
-        <el-table-column type="selection" width="30" :reserve-selection="true" />
-        <el-table-column type="index" label="序号" width="55" align="center" />
+        <el-table-column type="selection" width="30" :reserve-selection="true"/>
+        <el-table-column type="index" label="序号" width="55" align="center"/>
         <el-table-column width="150" v-for="h in  tableHeader" v-if="h.show" :label="h.name" align="center"
-          show-overflow-tooltip>
+                         show-overflow-tooltip>
           <!-- :prop="h.attribute == 'select' ? `${h.prop}Name` : h.prop" -->
           <template slot-scope="scope">
             {{ h.attribute == 'select' ? scope.row[`${h.prop}Name`] :
-              (h.attribute == 'checkbox' ?
-                (scope.row[h.prop] == '0' ? '√' : '')
-                : scope.row[h.prop])
+            (h.attribute == 'checkbox' ?
+            (scope.row[h.prop] == '0' ? '√' : '')
+            : scope.row[h.prop])
             }}
           </template>
         </el-table-column>
       </el-table>
 
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
-        :current-page="queryParams.pageNum" :page-sizes="[10, 20, 50, 100]"
-        layout="total, sizes, prev, pager, next, jumper" :total="total">
+                     :current-page="queryParams.pageNum" :page-sizes="[10, 20, 50, 100]"
+                     layout="total, sizes, prev, pager, next, jumper" :total="total">
       </el-pagination>
     </el-card>
 
@@ -131,7 +132,7 @@
     <el-dialog title="批量导入" :visible.sync="importData.show" width="35%" center :before-close="handlefileDialogColse">
       <div class="mb-import">
         <el-upload class="upload-demo" accept=".xls, .xlsx" ref="upload" action="#" :on-remove="handleFileRemove"
-          :file-list="importData.list" :auto-upload="false" :on-change="handleChangeFile" :limit="1">
+                   :file-list="importData.list" :auto-upload="false" :on-change="handleChangeFile" :limit="1">
           <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
           <el-button style="margin-left: 10px;" size="small" type="success" @click="handleDownTemplate">下载模板</el-button>
           <div slot="tip" class="el-upload__tip">只能上传Excel文件</div>
@@ -148,94 +149,150 @@
 </template>
 
 <script>
-import './style/index.scss';
-import materialApi from '@/api/material/basic';
-
-export default {
-  name: "material-basic",
-  data() {
-    return {
-      // 物料基本信息数据
-      taskList: [],
-      // 查询表单字段
-      queryForm: {
-        name: '',
-        code: '',
-        isEnable: '',
-      },
-      // 总条数
-      total: 1,
-      loading: false,
-      importData: {
-        show: false,
-        list: []
-      },
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        code: null,
-        name: null
-      },
-      // 表头
-      tableHeader: [],
-      // 多选数组
-      checkedList: [],
-      // 列表选中数据
-      // checkedList: [],
-      // 操作弹窗
-      optionDialog: {
-        show: false,
-        op: ''
-      },
-    }
-  },
+  import './style/index.scss';
+  import materialApi from '@/api/material/basic';
 
-  methods: {
-    // 判读是否启用
-    handleJudgeIsUsing() {
-      return this.checkedList.length == 1 && this.checkedList[0].isEnable == '已启用';
-    },
-    // 改变分页大小
-    handleSizeChange(e) {
-      this.queryParams.pageSize = e;
-      this.handleQuery();
-    },
-    // 改变当前页
-    handleCurrentChange(e) {
-      this.queryParams.pageNum = e;
-      this.handleQuery();
-    },
-    // 新增
-    handleInster() {
-      this.$message({
-        message: '物料只能通过申请审批增加,不能在节点直接录入!',
-        type: 'warning'
-      });
+  export default {
+    name: "material-basic",
+    data() {
+      return {
+        failLoad: false,
+        // 物料基本信息数据
+        taskList: [],
+        // 查询表单字段
+        queryForm: {
+          name: '',
+          code: '',
+          isEnable: '',
+        },
+        // 总条数
+        total: 1,
+        loading: false,
+        importData: {
+          show: false,
+          list: []
+        },
+        // 查询参数
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          code: null,
+          name: null
+        },
+        // 表头
+        tableHeader: [],
+        // 多选数组
+        checkedList: [],
+        // 列表选中数据
+        // checkedList: [],
+        // 操作弹窗
+        optionDialog: {
+          show: false,
+          op: ''
+        },
+      }
     },
-    // 修改
-    handleEdit() {
-      if (this.checkedList.length == 1) {
-        this.$router.push({
-          path: `/material/basicFile/detail/${this.checkedList[0].id}`,
-          query: {
-            isEdit: true
-          }
-        });
-      } else {
+
+    methods: {
+      // 判读是否启用
+      handleJudgeIsUsing() {
+        return this.checkedList.length == 1 && this.checkedList[0].isEnable == '已启用';
+      },
+      // 改变分页大小
+      handleSizeChange(e) {
+        this.queryParams.pageSize = e;
+        this.handleQuery();
+      },
+      // 改变当前页
+      handleCurrentChange(e) {
+        this.queryParams.pageNum = e;
+        this.handleQuery();
+      },
+      // 新增
+      handleInster() {
         this.$message({
-          message: `${this.checkedList.length > 1 ? '修改只能选择单个数据!' : '请选择需要修改的信息!'}`,
+          message: '物料只能通过申请审批增加,不能在节点直接录入!',
           type: 'warning'
         });
-      }
-    },
-    // 删除
-    handleDel() {
-      console.log('删除', this.checkedList);
-      // delMaterial
-      if (this.checkedList.length) {
-        let ids = this.checkedList.map(i => i.id);
-        materialApi.delMaterial(ids).then(res => {
+      },
+      // 修改
+      handleEdit() {
+        if (this.checkedList.length == 1) {
+          this.$router.push({
+            path: `/material/basicFile/detail/${this.checkedList[0].id}`,
+            query: {
+              isEdit: true
+            }
+          });
+        } else {
+          this.$message({
+            message: `${this.checkedList.length > 1 ? '修改只能选择单个数据!' : '请选择需要修改的信息!'}`,
+            type: 'warning'
+          });
+        }
+      },
+      // 删除
+      handleDel() {
+        console.log('删除', this.checkedList);
+        // delMaterial
+        if (this.checkedList.length) {
+          let ids = this.checkedList.map(i => i.id);
+          materialApi.delMaterial(ids).then(res => {
+            if (res.code == 200) {
+              this.handleRefresh();
+              // 清空选中数据
+              this.checkedList = [];
+              this.$refs.materialTable.clearSelection();
+            }
+          })
+        } else {
+          this.$message({
+            message: '请选择需要删除的数据!',
+            type: 'warning'
+          });
+        }
+
+      },
+      // 复制
+      handleCopy() {
+        console.log('复制');
+      },
+      //查询
+      handleQuery() {
+        this.getMaterialList('material');
+      },
+      // 重置查询条件
+      handleResetQuery() {
+        for (const key in this.queryForm) {
+
+          this.queryForm[key] = '';
+        }
+      },
+      // 刷新
+      handleRefresh() {
+        this.getMaterialList('material');
+        for (const key in this.queryForm) {
+          this.queryForm[key] = '';
+        }
+      },
+      // 过滤
+      handleFilter(e) {
+        console.log(e, '过滤');
+      },
+      filterCondition(type) {
+        return {
+          type
+        }
+      },
+      // 启用/停用
+      handleIsInvoke() {
+        // true   当前状态为启用,需要改为停用
+        // 0:启用  2:停用
+        let param = {
+          isEnable: this.handleJudgeIsUsing() ? '2' : '0',
+          id: this.checkedList[0].id
+        };
+        materialApi.updateEnableMaterial(param).then(res => {
           if (res.code == 200) {
             this.handleRefresh();
             // 清空选中数据
@@ -243,334 +300,300 @@ export default {
             this.$refs.materialTable.clearSelection();
           }
         })
-      } else {
-        this.$message({
-          message: '请选择需要删除的数据!',
-          type: 'warning'
-        });
-      }
 
-    },
-    // 复制
-    handleCopy() {
-      console.log('复制');
-    },
-    //查询 
-    handleQuery() {
-      this.getMaterialList('material');
-    },
-    // 重置查询条件
-    handleResetQuery() {
-      for (const key in this.queryForm) {
-
-        this.queryForm[key] = '';
-      }
-    },
-    // 刷新
-    handleRefresh() {
-      this.getMaterialList('material');
-      for (const key in this.queryForm) {
-        this.queryForm[key] = '';
-      }
-    },
-    // 过滤
-    handleFilter(e) {
-      console.log(e, '过滤');
-    },
-    filterCondition(type) {
-      return {
-        type
-      }
-    },
-    // 启用/停用
-    handleIsInvoke() {
-      // true   当前状态为启用,需要改为停用
-      // 0:启用  2:停用
-      let param = {
-        isEnable: this.handleJudgeIsUsing() ? '2' : '0',
-        id: this.checkedList[0].id
-      };
-      materialApi.updateEnableMaterial(param).then(res => {
-        if (res.code == 200) {
-          this.handleRefresh();
-          // 清空选中数据
-          this.checkedList = [];
-          this.$refs.materialTable.clearSelection();
-        }
-      })
-
-    },
-    isInvoke(val) {
-      return val;
-    },
-    // 申请单查询
-    handleQueryForm() {
-      console.log('申请单查询');
-    },
-    // 批量导入
-    handleImport() {
-      this.importData.show = true
-    },
-    // 导入弹窗关闭前
-    handlefileDialogColse(done) {
-      this.importData.list = [];
-      done();
-    },
-    // 导入弹窗操作
-    handleImportData(type) {
-      switch (type) {
-        // 取消
-        case 'cancal':
-          this.importData.list = [];
-          this.importData.show = false;
-          break;
-        // 确认
-        case 'confirm':
-          if (this.importData.list.length) {
-
-            let formData = new FormData();
-
-            formData.append('file', this.importData.list[0].raw);
-            materialApi.fileImport(formData).then(res => {
-              if (res.code == 200) {
-                this.importData.show = false;
-                this.importData.list = [];
-              }
+      },
+      isInvoke(val) {
+        return val;
+      },
+      // 申请单查询
+      handleQueryForm() {
+        console.log('申请单查询');
+      },
+      // 批量导入
+      handleImport() {
+        this.importData.show = true
+      },
+      // 导入弹窗关闭前
+      handlefileDialogColse(done) {
+        this.importData.list = [];
+        done();
+      },
+      // 导入弹窗操作
+      handleImportData(type) {
+        switch (type) {
+          // 取消
+          case 'cancal':
+            this.importData.list = [];
+            this.importData.show = false;
+            break;
+          // 确认
+          case 'confirm':
+            if (this.importData.list.length) {
+
+              let formData = new FormData();
+
+              formData.append('file', this.importData.list[0].raw);
+              materialApi.fileImport(formData).then(res => {
+                if (res.code == 200) {
+                  this.importData.show = false;
+                  this.importData.list = [];
+                  if (res.data.flag) {
+                    this.failLoad = true;
+                    console.log(res.data.datas)
+                    let param = {failDatas: res.data.datas}
+                    if (null != param) {
+                      materialApi.exportMartial(param).then(res => {
+                        const blob = new Blob([res], {
+                          type: "application/vnd.ms-excel;charset=UTF-8",
+                        });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
+                        const downloadElement = document.createElement("a"); //创建a标签
+                        const href = window.URL.createObjectURL(blob); // 创建下载的链接
+                        downloadElement.href = href;  //下载地址
+                        downloadElement.download = '导入失败的物料基础档案数据.xlsx'; // 下载后文件名
+                        document.body.appendChild(downloadElement);
+                        downloadElement.click(); // 点击下载
+                        document.body.removeChild(downloadElement); // 下载完成移除元素
+                        window.URL.revokeObjectURL(href); // 释放blob对象
+                        this.failLoad = false;
+                      })
+                    }
+                  }
+                  this.$message({
+                    message: res.data.msg,
+                    type: res.data.flag ? 'warning' : 'success'
+                  });
+                } else {
+                  this.$message({
+                    message: res.msg,
+                    type: res.code == 200 ? 'success' : 'warning'
+                  });
+                }
+              })
+            } else {
               this.$message({
-                message: res.msg,
-                type: res.code == 200 ? 'success' : 'warning'
+                message: '请上传文件之后在确认!',
+                type: 'warning'
               });
-            })
-          } else {
-            this.$message({
-              message: '请上传文件之后在确认!',
-              type: 'warning'
-            });
-          }
-          break;
-      }
-    },
-
-    // 删除文件
-    handleFileRemove(file, fileList) {
-      console.log('删除文件', file, 'file', fileList, 'fileList');
-      this.importData.list = fileList;
-    },
-    // 文件发生改变
-    handleChangeFile(file, fileList) {
-      this.importData.list = fileList;
-    },
-    // 批量导出
-    handleExport() {
-
-      let ids = this.checkedList.length ? this.checkedList.map(i => i.id) : [];
-
-      if (ids.length) {
-
-        let params = {
-          // orgId: '1',
-          ids,
+            }
+            break;
         }
-        this.download('/system/material/export', params, `物料基本信息${new Date().getTime()}.xlsx`);
-      } else {
-        this.$message({
-          message: '请选择需要导出的数据!',
-          type: 'warning'
-        });
-      }
-
-    },
-    // 下载模板
-    handleDownTemplate() {
-      this.download('/system/material/download', {}, `物料基本信息模板.xlsx`)
-    },
-
+      },
 
-    // 操作弹窗显隐
-    handleOptionShow(type, val) {
-      switch (type) {
-        case 'option':
-          this.optionDialog.show = val;
-          break;
-      }
-    },
-    // 操作弹窗确认按钮
-    handleComfirmOption(op) {
-      switch (op) {
-        case 'cancal':
-          this.handleOptionShow('option', false);
-          break;
-      }
-    },
+      // 删除文件
+      handleFileRemove(file, fileList) {
+        console.log('删除文件', file, 'file', fileList, 'fileList');
+        this.importData.list = fileList;
+      },
+      // 文件发生改变
+      handleChangeFile(file, fileList) {
+        this.importData.list = fileList;
+      },
+      // 批量导出
+      handleExport() {
 
+        let ids = this.checkedList.length ? this.checkedList.map(i => i.id) : [];
 
+        if (ids.length) {
 
-    // 双击行
-    handledbClick(e) {
-      this.$router.push({
-        path: `/material/basicFile/detail/${e.id}`,
-      });
-    },
-    // 绑定row-key
-    getRowKey(row) {
-      return row.id;
-    },
-    // 对象数组去重
-    handleUnique(arr, key) {
-      // arr  需要去重的数组   type:作为去重依据的key
-      const res = new Map();
-      return arr.filter((arr) => !res.has(arr[key]) && res.set(arr[key], 1))
-    },
-    // 选中数据改变
-    handleSelectionChange(list) {
-      // this.checkedList = this.handleUnique([...this.checkedList, ...list], 'id');
-      // this.$emit('headerOption', JSON.stringify({ checkedList: [... this.checkedList] }))
-    },
-    // 行数据勾选操作 
-    handleSelect(selection, row) {
-      this.checkedList = selection;
-      // // true就是选中,0或者false是取消选中
-      // let selected = selection.length && selection.indexOf(row) !== -1
+          let params = {
+            // orgId: '1',
+            ids,
+          }
+          this.download('/system/material/export', params, `物料基本信息${new Date().getTime()}.xlsx`);
+        } else {
+          this.$message({
+            message: '请选择需要导出的数据!',
+            type: 'warning'
+          });
+        }
 
-    },
-    //手动勾选全选 
-    handleSelectAll(selection) {
-      this.checkedList = selection;
-    },
-    // 获取物料列表信息
-    getMaterialList(templateCode, query) {
-      let _this = this;
-      this.loading = true;
-      let page = {
-        pageNum: this.queryParams.pageNum,
-        pageSize: this.queryParams.pageSize,
-      }
+      },
+      // 下载模板
+      handleDownTemplate() {
+        this.download('/system/material/download', {}, `物料基本信息模板.xlsx`)
+      },
 
-      let param = {
-        templateCode,
-        ...this.queryForm
-      }
-      // console.log(param, 'param');
-      materialApi.materialList(param, page).then((res) => {
-        _this.loading = false;
-        console.log(res, '获取物料列表信息以及表头字段');
-        let { code, data } = res;
-        if (code == 200) {
-          _this.taskList = data.tableBody.rows;
-          _this.total = data.tableBody.total;
 
+      // 操作弹窗显隐
+      handleOptionShow(type, val) {
+        switch (type) {
+          case 'option':
+            this.optionDialog.show = val;
+            break;
         }
-      })
-    },
-    // 获取物料列表表头
-    getTagList(templateCode) {
-      materialApi.tagList({ templateCode }).then(res => {
-        console.log(res, '获取物料列表表头');
-        if (res.code == 200) {
-          this.tableHeader = res.data;
+      },
+      // 操作弹窗确认按钮
+      handleComfirmOption(op) {
+        switch (op) {
+          case 'cancal':
+            this.handleOptionShow('option', false);
+            break;
         }
-      })
-    },
+      },
 
 
+      // 双击行
+      handledbClick(e) {
+        this.$router.push({
+          path: `/material/basicFile/detail/${e.id}`,
+        });
+      },
+      // 绑定row-key
+      getRowKey(row) {
+        return row.id;
+      },
+      // 对象数组去重
+      handleUnique(arr, key) {
+        // arr  需要去重的数组   type:作为去重依据的key
+        const res = new Map();
+        return arr.filter((arr) => !res.has(arr[key]) && res.set(arr[key], 1))
+      },
+      // 选中数据改变
+      handleSelectionChange(list) {
+        // this.checkedList = this.handleUnique([...this.checkedList, ...list], 'id');
+        // this.$emit('headerOption', JSON.stringify({ checkedList: [... this.checkedList] }))
+      },
+      // 行数据勾选操作
+      handleSelect(selection, row) {
+        this.checkedList = selection;
+        // // true就是选中,0或者false是取消选中
+        // let selected = selection.length && selection.indexOf(row) !== -1
 
+      },
+      //手动勾选全选
+      handleSelectAll(selection) {
+        this.checkedList = selection;
+      },
+      // 获取物料列表信息
+      getMaterialList(templateCode, query) {
+        let _this = this;
+        this.loading = true;
+        let page = {
+          pageNum: this.queryParams.pageNum,
+          pageSize: this.queryParams.pageSize,
+        }
 
+        let param = {
+          templateCode,
+          ...this.queryForm
+        }
+        // console.log(param, 'param');
+        materialApi.materialList(param, page).then((res) => {
+          _this.loading = false;
+          console.log(res, '获取物料列表信息以及表头字段');
+          let {code, data} = res;
+          if (code == 200) {
+            _this.taskList = data.tableBody.rows;
+            _this.total = data.tableBody.total;
 
+          }
+        })
+      },
+      // 获取物料列表表头
+      getTagList(templateCode) {
+        materialApi.tagList({templateCode}).then(res => {
+          console.log(res, '获取物料列表表头');
+          if (res.code == 200) {
+            this.tableHeader = res.data;
+          }
+        })
+      },
 
-  },
-  created() {
-    // this.getMaterialList('material');
-    // this.getTagList('material');
-  },
-  beforeRouteEnter(to, from, next) {
 
-    next((vm) => {
-      if (from.name == 'materialDetail') {
-        // this.$store.getQuery(this.queryForm);
-        console.log(vm, 'queryValue', vm.$store);
-        vm.queryForm = vm.$store.state.query.queryVlue;
-        // 清空选中数据
-        vm.checkedList = [];
-        vm.$refs.materialTable.clearSelection();
+    },
+    created() {
+      // this.getMaterialList('material');
+      // this.getTagList('material');
+    },
+    beforeRouteEnter(to, from, next) {
+
+      next((vm) => {
+        if (from.name == 'materialDetail') {
+          // this.$store.getQuery(this.queryForm);
+          console.log(vm, 'queryValue', vm.$store);
+          vm.queryForm = vm.$store.state.query.queryVlue;
+          // 清空选中数据
+          vm.checkedList = [];
+          vm.$refs.materialTable.clearSelection();
+        }
+        vm.getTagList('material');
+        vm.getMaterialList('material');
+      });
+    },
+    // 进入详情,保留查询条件
+    beforeRouteLeave(to, from, next) {
+      if (to.name == 'materialDetail') {
+        this.$store.commit('SET_QUERY', this.queryForm);
+      } else {
+        this.$store.commit('SET_QUERY', {name: '', code: ''});
       }
-      vm.getTagList('material');
-      vm.getMaterialList('material');
-    });
-  },
-  // 进入详情,保留查询条件
-  beforeRouteLeave(to, from, next) {
-    if (to.name == 'materialDetail') {
-      this.$store.commit('SET_QUERY', this.queryForm);
-    } else {
-      this.$store.commit('SET_QUERY', { name: '', code: '' });
+      next();
     }
-    next();
-  }
 
-};
+  };
 </script>
 
 
 <style lang="scss">
-.material-list {
-  // height: calc(100% - 100px);
-  height: calc(100% - 70px);
-
-
-  .el-card__body {
-    height: 100%;
-    box-sizing: border-box;
-
-    .el-table {
-      height: calc(100% - 35px);
-      overflow: auto;
-
-      .el-table__body-wrapper {
-        // height: calc(100% - 150px);
-        height: calc(100% - 70px);
-        overflow-y: auto !important;
-        overflow-x: auto !important;
-        // .el-table__body {
-        //   height: 100%;
-        // }
+  .material-list {
+    // height: calc(100% - 100px);
+    height: calc(100% - 70px);
+
+
+    .el-card__body {
+      height: 100%;
+      box-sizing: border-box;
+
+      .el-table {
+        height: calc(100% - 35px);
+        overflow: auto;
+
+        .el-table__body-wrapper {
+          // height: calc(100% - 150px);
+          height: calc(100% - 70px);
+          overflow-y: auto !important;
+          overflow-x: auto !important;
+          // .el-table__body {
+          //   height: 100%;
+          // }
+        }
       }
     }
+
+    .el-pagination {
+      margin-top: 8px;
+      text-align: right;
+    }
   }
 
-  .el-pagination {
-    margin-top: 8px;
-    text-align: right;
+  .mb-import {
+    padding: 0 20%;
+    text-align: center;
+    display: flex;
+    align-items: flex-start;
+    justify-content: space-around;
   }
-}
-
-.mb-import {
-  padding: 0 20%;
-  text-align: center;
-  display: flex;
-  align-items: flex-start;
-  justify-content: space-around;
-}
 </style>
 <style scoped>
-.el-dialog__header {
-  background-color: rgb(244, 244, 244);
-}
+  .el-dialog__header {
+    background-color: rgb(244, 244, 244);
+  }
 
-.mb-query>>>.el-form-item__label {
-  font-weight: normal;
-  font-size: 12px;
-}
+  .mb-query >>> .el-form-item__label {
+    font-weight: normal;
+    font-size: 12px;
+  }
 
-.mb-query>>>.el-form-item {
-  margin-bottom: 8px;
-}
+  .mb-query >>> .el-form-item {
+    margin-bottom: 8px;
+  }
 
-.mb-query>>>.el-select {
-  width: 90px;
-}
+  .mb-query >>> .el-select {
+    width: 90px;
+  }
 
-.mb-query>>>.el-scrollbar__wrap {
-  margin-bottom: -18px;
+  .mb-query >>> .el-scrollbar__wrap {
+    margin-bottom: -18px;
 
-}
+  }
 </style>