瀏覽代碼

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!534
黄梓星 1 年之前
父節點
當前提交
30d3228e8d

+ 6 - 1
src/components/super-form/index.vue

@@ -84,6 +84,7 @@ export default {
 
 <template>
   <el-form
+    class="superForm"
     ref="superForm"
     v-bind="$attrs"
     v-on="$listeners"
@@ -167,4 +168,8 @@ export default {
   </el-form>
 </template>
 
-<style scoped></style>
+<style scoped>
+.superForm>>>.el-form-item{
+  margin-bottom: 12px;
+}
+</style>

+ 7 - 2
src/components/super-search/index.vue

@@ -64,7 +64,7 @@ export default {
             }) / 24
         );
         const multiples = this.visible ? maxMultiples : 1;
-        return multiples * 47 + "px";
+        return multiples * 41 + "px";
       },
       set() {},
     },
@@ -83,6 +83,7 @@ export default {
 
 <template>
   <el-form
+    class="superForm"
     ref="superForm"
     v-bind="$attrs"
     v-on="$listeners"
@@ -210,4 +211,8 @@ export default {
   </el-form>
 </template>
 
-<style scoped></style>
+<style scoped>
+.superForm>>>.el-form-item{
+  margin-bottom: 12px;
+}
+</style>

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

@@ -296,7 +296,7 @@ export default {
             if (!isNaN(value)) {
               return prev + curr;
             } else {
-              return '';
+              return prev + 0;
             }
           }, 0);
           sums[index] = sums[index] && sums[index].toFixed(2) // 保留2位小数,解决小数合计列;

+ 403 - 482
src/views/material/basicFile/index.vue

@@ -16,36 +16,7 @@
         @reset="handleResetQuery"
         @submit="handleQuery"
       ></el-super-search>
-      <!-- <el-row :gutter="10">
-        <el-col :span="1.5">
-          <el-form :inline="true" :model="queryForm" class="mb-query" @submit.native.prevent>
-            <el-form-item label="物料编码">
-              <el-input size="small" v-model="queryForm.code" placeholder="物料编码" clearable></el-input>
-            </el-form-item>
-            <el-form-item label="物料名称">
-              <el-input size="small" v-model="queryForm.name" placeholder="物料名称" clearable></el-input>
-            </el-form-item>
-            <el-form-item label="启用状态">
-              <el-select size="small" v-model="queryForm.isEnable" placeholder="请选择" clearable>
-                <el-option key="0" label="已启用" value="0"></el-option>
-                <el-option key="2" label="已停用" value="2"></el-option>
-              </el-select>
-            </el-form-item>
-            <el-form-item label="是否同步NC">
-              <el-select size="small" v-model="queryForm.isSync" placeholder="请选择" clearable>
-                <el-option key="0" label="是" value="0"></el-option>
-                <el-option key="2" label="否" value="2"></el-option>
-              </el-select>
-            </el-form-item>
-
-            <el-form-item>
-              <el-button size="small" type="primary" @click="handleQuery">搜 索</el-button>
-              <el-button size="small" @click="handleResetQuery">重 置</el-button>
-            </el-form-item>
-          </el-form>
-        </el-col>
-
-      </el-row> -->
+    
     </div>
     <!-- 操作栏 -->
       <el-row 
@@ -57,37 +28,15 @@
         <!-- 新增、修改、删除、复制 -->
         <el-col :span="1.5">
           <el-button-group>
-            <!-- <el-button size="small" @click="handleInster">新增</el-button> -->
-            <el-button size="small" @click="handleEdit">修改</el-button>
-            <!-- <el-button size="small" @click="handleDel">删除</el-button> -->
-            <!-- <el-button size="small" @click="handleCopy">复制</el-button> -->
-          </el-button-group>
-        </el-col>
-
-        <!-- 查询、刷新、过滤 -->
-        <el-col :span="1.5">
-          <el-button-group>
-
-            <!-- <el-dropdown size="small" @command="handleFilter">
-            <el-button size="small">
-              过滤<i class="el-icon-arrow-down el-icon--right"></i>
-            </el-button>
-            <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item :command="filterCondition('stop')">显示停用</el-dropdown-item>
-              <el-dropdown-item :command="filterCondition('allot')">显示已分配</el-dropdown-item>
-            </el-dropdown-menu>
-          </el-dropdown> -->
-
-            <!-- <el-button size="small" @click="handleQuery">查询</el-button> -->
-            <el-button size="small" @click="handleRefresh">刷新</el-button>
-
+            <el-button :size="size" @click="handleEdit">修改</el-button>
+            <el-button :size="size" @click="handleRefresh">刷新</el-button>
           </el-button-group>
         </el-col>
 
         <!-- 启用 -->
         <el-col :span="1.5">
           <el-button-group>
-            <el-button size="small" @click="handleIsInvoke" :disabled="checkedList.length != 1"
+            <el-button :size="size" @click="handleIsInvoke" :disabled="checkedList.length != 1"
                        v-hasPermi="['system:material:add']">
               <!-- 0:启用  2:停用 -->
               {{ handleJudgeIsUsing() ? '停用' : '启用' }}
@@ -98,8 +47,8 @@
         <!-- 导入导出 -->
         <el-col :span="1.5">
           <el-button-group>
-            <el-button size="small" @click="handleImport" v-hasPermi="['system:material:import']">批量导入</el-button>
-            <el-button size="small" @click="handleExport" v-hasPermi="['system:material:export']">批量导出</el-button>
+            <el-button :size="size" @click="handleImport" v-hasPermi="['system:material:import']">批量导入</el-button>
+            <el-button :size="size" @click="handleExport" v-hasPermi="['system:material:export']">批量导出</el-button>
           </el-button-group>
         </el-col>
 
@@ -117,6 +66,7 @@
         @selection-change="handleSelectionChange" 
         @select="handleSelect" 
         @select-all="handleSelectAll"
+        :size="size"
       >
         <!--  -->
         <el-table-column type="selection" width="45" :reserve-selection="true" fixed/>
@@ -161,15 +111,6 @@
         style="height: 32px; padding: 0 !important; "
       />
 
-      <!-- <el-pagination 
-        @size-change="handleSizeChange" 
-        @current-change="handleCurrentChange"
-        :current-page="queryParams.pageNum" 
-        :page-sizes="[10, 20, 50, 100,200,500]"
-        layout="total, sizes, prev, pager, next, jumper" 
-        :total="total"
-      >
-      </el-pagination> -->
     </el-card>
 
     <!-- 操作提示 -->
@@ -186,8 +127,8 @@
       <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">
-          <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
-          <el-button style="margin-left: 10px;" size="small" type="success" @click="handleDownTemplate">下载模板</el-button>
+          <el-button slot="trigger" :size="size" type="primary">选取文件</el-button>
+          <el-button style="margin-left: 10px;" :size="size" type="success" @click="handleDownTemplate">下载模板</el-button>
           <div slot="tip" class="el-upload__tip">只能上传Excel文件</div>
         </el-upload>
 
@@ -202,178 +143,101 @@
 </template>
 
 <script>
-  import './style/index.scss';
-  import materialApi from '@/api/material/basic';
-  import { SearchColumns,OtherDictColumns } from './columns';
-  import { initDicts } from "@/utils/init.js";
-
-  export default {
-    name: "material-basic",
-    dicts:[...initDicts([...SearchColumns,...OtherDictColumns])],
-    // dicts:[],
-    components: {
-      ElSuperSearch: () => import("@/components/super-search/index.vue"),
-      ElDictTag: () => import("@/components/DictTag/index.vue"),
-      
+import './style/index.scss';
+import materialApi from '@/api/material/basic';
+import { SearchColumns,OtherDictColumns } from './columns';
+import { initDicts } from "@/utils/init.js";
+
+export default {
+  name: "material-basic",
+  dicts:[...initDicts([...SearchColumns,...OtherDictColumns])],
+  components: {
+    ElSuperSearch: () => import("@/components/super-search/index.vue"),
+    ElDictTag: () => import("@/components/DictTag/index.vue"),
+    
+  },
+  data() {
+    const params = this.$init.params(SearchColumns);
+  
+    return {
+      failLoad: false,
+      params:params,
+      SearchColumns:SearchColumns,
+      size:'mini',
+      // 物料基本信息数据
+      taskList: [],
+      // 查询表单字段
+      queryForm: {
+        name: '',
+        code: '',
+        isEnable: '',
+      },
+      // 总条数
+      total: 1,
+      loading: false,
+      importData: {
+        show: false,
+        list: []
+      },
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 50,
+        code: null,
+        name: null
+      },
+      // 表头
+      tableHeader: [],
+      // 多选数组
+      checkedList: [],
+      // 列表选中数据
+      // checkedList: [],
+      // 操作弹窗
+      optionDialog: {
+        show: false,
+        op: ''
+      },
+    }
+  },
+
+  methods: {
+    // 判读是否启用
+    handleJudgeIsUsing() {
+      return this.checkedList.length == 1 && this.checkedList[0].isEnable == '已启用';
     },
-    data() {
-      const params = this.$init.params(SearchColumns);
-     
-      return {
-        failLoad: false,
-        params:params,
-        SearchColumns:SearchColumns,
-        size:'mini',
-        // 物料基本信息数据
-        taskList: [],
-        // 查询表单字段
-        queryForm: {
-          name: '',
-          code: '',
-          isEnable: '',
-        },
-        // 总条数
-        total: 1,
-        loading: false,
-        importData: {
-          show: false,
-          list: []
-        },
-        // 查询参数
-        queryParams: {
-          pageNum: 1,
-          pageSize: 50,
-          code: null,
-          name: null
-        },
-        // 表头
-        tableHeader: [],
-        // 多选数组
-        checkedList: [],
-        // 列表选中数据
-        // checkedList: [],
-        // 操作弹窗
-        optionDialog: {
-          show: false,
-          op: ''
-        },
-      }
+    
+    // 新增
+    handleInster() {
+      this.$notify({
+        title: '警告',
+        message: '物料只能通过申请审批增加,不能在节点直接录入!',
+        type: 'warning'
+      });
     },
-
-    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() {
+    // 修改
+    handleEdit() {
+      if (this.checkedList.length == 1) {
+        this.$router.push({
+          path: `/material/basicFile/detail/${this.checkedList[0].id}`,
+          query: {
+            isEdit: true
+          }
+        });
+      } else {
         this.$notify({
           title: '警告',
-          message: '物料只能通过申请审批增加,不能在节点直接录入!',
+          message: `${this.checkedList.length > 1 ? '修改只能选择单个数据!' : '请选择需要修改的信息!'}`,
           type: 'warning'
         });
-      },
-      // 修改
-      handleEdit() {
-        if (this.checkedList.length == 1) {
-          this.$router.push({
-            path: `/material/basicFile/detail/${this.checkedList[0].id}`,
-            query: {
-              isEdit: true
-            }
-          });
-        } else {
-          this.$notify({
-            title: '警告',
-            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.$notify({
-            title: '警告',
-            message: `请选择需要删除的数据!`,
-            type: 'warning'
-          });
-        }
-
-      },
-      // 复制
-      handleCopy() {
-        console.log('复制');
-      },
-      //查询
-      handleQuery() {
-        // 重新查询后需要清空列表选中的数据
-        this.checkedList = [];
-        this.$refs.materialTable.clearSelection();
-        this.getMaterialList('material');
-      },
-      // 重置查询条件
-      handleResetQuery() {
-        // for (const key in this.queryForm) {
-
-        //   this.queryForm[key] = '';
-        // }
-
-        this.queryParams.pageNum = 1;
-      
-        this.queryParams.pageSize = 100;
-
-        this.params = this.$init.params(SearchColumns);
-
-        this.handleQuery();
-      },
-      // 刷新
-      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 => {
+      }
+    },
+    // 删除
+    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();
             // 清空选中数据
@@ -381,283 +245,340 @@
             this.$refs.materialTable.clearSelection();
           }
         })
+      } else {
+        this.$notify({
+          title: '警告',
+          message: `请选择需要删除的数据!`,
+          type: 'warning'
+        });
+      }
 
-      },
-      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.$notify({
-                    message: res.data.msg,
-                    type: res.data.flag ? 'warning' : 'success'
-                  });
-                  
-                } else {
-                  this.$notify({
-                    message: res.msg,
-                    type: res.code == 200 ? 'success' : 'warning'
-                  });
-                }
-              })
-            } else {
-              this.$notify({
-                title:'警告',
-                message: '请上传文件之后在确认!',
-                type: 'warning',
-              });
-            }
-            break;
-        }
-      },
+    },
+    // 复制
+    handleCopy() {
+      console.log('复制');
+    },
+    //查询
+    handleQuery() {
+      // 重新查询后需要清空列表选中的数据
+      this.checkedList = [];
+      this.$refs.materialTable.clearSelection();
+      this.getMaterialList();
+    },
+    // 重置查询条件
+    handleResetQuery() {
+      // for (const key in this.queryForm) {
 
-      // 删除文件
-      handleFileRemove(file, fileList) {
-        // console.log('删除文件', file, 'file', fileList, 'fileList');
-        this.importData.list = fileList;
-      },
-      // 文件发生改变
-      handleChangeFile(file, fileList) {
-        this.importData.list = fileList;
-      },
+      //   this.queryForm[key] = '';
+      // }
 
-      // 批量导出
-      handleExport() {
+      this.queryParams.pageNum = 1;
+    
+      this.queryParams.pageSize = 100;
 
-        let ids = this.checkedList.length ? this.checkedList.map(i => i.id) : [];
+      this.params = this.$init.params(SearchColumns);
 
-        if (ids.length) {
+      this.handleQuery();
+    },
+    // 刷新
+    handleRefresh() {
+      this.getMaterialList();
+      // for (const key in this.queryForm) {
+      //   this.queryForm[key] = '';
+      // }
+    },
+  
+    // 启用/停用
+    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();
+        }
+      })
 
-          let params = {
-            // orgId: '1',
-            ids,
-          }
-          this.download('/system/material/export', params, `物料基本信息${new Date().getTime()}.xlsx`);
-        } else {
-          let params = {
-            templateCode:'material',
-            ...this.params,
-            createTimeBegin: (this.params.createTimeQueue && this.params.createTimeQueue[0]) || '',
-            createTimeEnd:(this.params.createTimeQueue && this.params.createTimeQueue[1]) || '',
-            updateTimeBegin:(this.params.updateTimeQueue && this.params.updateTimeQueue[0]) || '',
-            updateTimeEnd:(this.params.updateTimeQueue && this.params.updateTimeQueue[1]) || ''
+    },
+    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.$notify({
+                  message: res.data.msg,
+                  type: res.data.flag ? 'warning' : 'success'
+                });
+                
+              } else {
+                this.$notify({
+                  message: res.msg,
+                  type: res.code == 200 ? 'success' : 'warning'
+                });
+              }
+            })
+          } else {
+            this.$notify({
+              title:'警告',
+              message: '请上传文件之后在确认!',
+              type: 'warning',
+            });
           }
-          this.download('/system/material/export', params, `物料基本信息${new Date().getTime()}.xlsx`);
-        }
+          break;
+      }
+    },
 
-      },
-      // 下载模板
-      handleDownTemplate() {
-        this.download('/system/material/download', {}, `物料基本信息模板.xlsx`)
-      },
+    // 删除文件
+    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) {
 
-      // 操作弹窗显隐
-      handleOptionShow(type, val) {
-        switch (type) {
-          case 'option':
-            this.optionDialog.show = val;
-            break;
+        let params = {
+          // orgId: '1',
+          ids,
         }
-      },
-      // 操作弹窗确认按钮
-      handleComfirmOption(op) {
-        switch (op) {
-          case 'cancal':
-            this.handleOptionShow('option', false);
-            break;
+        this.download('/system/material/export', params, `物料基本信息${new Date().getTime()}.xlsx`);
+      } else {
+        let params = {
+          templateCode:'material_list',
+          ...this.params,
+          createTimeBegin: (this.params.createTimeQueue && this.params.createTimeQueue[0]) || '',
+          createTimeEnd:(this.params.createTimeQueue && this.params.createTimeQueue[1]) || '',
+          updateTimeBegin:(this.params.updateTimeQueue && this.params.updateTimeQueue[0]) || '',
+          updateTimeEnd:(this.params.updateTimeQueue && this.params.updateTimeQueue[1]) || ''
         }
-      },
+        this.download('/system/material/export', params, `物料基本信息${new Date().getTime()}.xlsx`);
+      }
 
+    },
+    // 下载模板
+    handleDownTemplate() {
+      this.download('/system/material/download', {}, `物料基本信息模板.xlsx`)
+    },
 
-      // 双击行
-      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;
-      },
-      // 获取物料列表信息
-      async getMaterialList(templateCode, query) {
-
-        try {
-          this.loading = true;
-          let page = {
-            pageNum: this.queryParams.pageNum,
-            pageSize: this.queryParams.pageSize,
-          }
-
-          let param = {
-            templateCode,
-            ...this.params,
-            createTimeBegin: (this.params.createTimeQueue && this.params.createTimeQueue[0]) || '',
-            createTimeEnd:(this.params.createTimeQueue && this.params.createTimeQueue[1]) || '',
-            updateTimeBegin:(this.params.updateTimeQueue && this.params.updateTimeQueue[0]) || '',
-            updateTimeEnd:(this.params.updateTimeQueue && this.params.updateTimeQueue[1]) || ''
-          }
+    // 操作弹窗显隐
+    handleOptionShow(type, val) {
+      switch (type) {
+        case 'option':
+          this.optionDialog.show = val;
+          break;
+      }
+    },
+    // 操作弹窗确认按钮
+    handleComfirmOption(op) {
+      switch (op) {
+        case 'cancal':
+          this.handleOptionShow('option', false);
+          break;
+      }
+    },
 
-          console.log(param,'param--------------');
 
-          let {code,data} = await  materialApi.materialList(param, page);
-          
-          if (code == 200) {
-            this.taskList = data.tableBody.rows;
-            this.total = data.tableBody.total;
+    // 双击行
+    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
 
-          }
-        } catch (error) {
-          
-        }finally{
-          this.loading = false;
+    },
+    //手动勾选全选
+    handleSelectAll(selection) {
+      this.checkedList = selection;
+    },
+    // 获取物料列表信息
+    async getMaterialList() {
+
+      try {
+        this.loading = true;
+        let page = {
+          pageNum: this.queryParams.pageNum,
+          pageSize: this.queryParams.pageSize,
         }
-       
-        // 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) {
 
-            // let dictList = []
-            // res.data.forEach(item =>{
-            //   if(item.dictId){
-            //     // 字典
-            //     dictList.push({
-            //       item:{...item},
-            //       attr:{
-            //         dictName:item.dictId
-            //       }
-            //     });
-                
-            //   }
-            // })
-            // console.log(dictList,'dictList');
-            // console.log(this,'this');
-            // this.dict =[...initDicts([...SearchColumns,...dictList])]
+        let param = {
+          templateCode:'material_list',
+          ...this.params,
+          createTimeBegin: (this.params.createTimeQueue && this.params.createTimeQueue[0]) || '',
+          createTimeEnd:(this.params.createTimeQueue && this.params.createTimeQueue[1]) || '',
+          updateTimeBegin:(this.params.updateTimeQueue && this.params.updateTimeQueue[0]) || '',
+          updateTimeEnd:(this.params.updateTimeQueue && this.params.updateTimeQueue[1]) || ''
+        }
 
-            this.tableHeader = res.data;
-          }
-        })
-      },
+        console.log(param,'param--------------');
 
+        let {code,data} = await  materialApi.materialList(param, page);
+        
+        if (code == 200) {
+          this.taskList = data.tableBody.rows;
+          this.total = data.tableBody.total;
 
+        }
+      } catch (error) {
+        
+      }finally{
+        this.loading = false;
+      }
+    
+      // 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;
+
+      //   }
+      // })
     },
-    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 &&vm.$refs.materialTable.clearSelection();
+    // 获取物料列表表头
+    getTagList(templateCode) {
+      materialApi.tagList({templateCode}).then(res => {
+        console.log(res, '获取物料列表表头');
+        if (res.code == 200) {
+
+          // let dictList = []
+          // res.data.forEach(item =>{
+          //   if(item.dictId){
+          //     // 字典
+          //     dictList.push({
+          //       item:{...item},
+          //       attr:{
+          //         dictName:item.dictId
+          //       }
+          //     });
+              
+          //   }
+          // })
+          // console.log(dictList,'dictList');
+          // console.log(this,'this');
+          // this.dict =[...initDicts([...SearchColumns,...dictList])]
+
+          this.tableHeader = res.data;
         }
-        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: ''});
+
+
+  },
+  created() {
+  },
+  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 &&vm.$refs.materialTable.clearSelection();
       }
-      next();
+      vm.getTagList('material');
+      vm.getMaterialList();
+    });
+  },
+  // 进入详情,保留查询条件
+  beforeRouteLeave(to, from, next) {
+    if (to.name == 'materialDetail') {
+      this.$store.commit('SET_QUERY', this.queryForm);
+    } else {
+      this.$store.commit('SET_QUERY', {name: '', code: ''});
     }
+    next();
+  }
 
-  };
+};
 </script>
 
 

+ 16 - 0
src/views/purchase/purchase-order/add/column.js

@@ -361,6 +361,14 @@ const PurColumns =[
     inputType: "Textarea",
     isShow:true,
    },
+   {
+    key: "sysFileRecordList",
+    title: "附件",
+    inputType: "Upload",
+    span:24,
+    // fileType: ["pdf",""],
+    isShow:true,
+  },
 
 ];
 const PurchaseTabColumns =[
@@ -1117,6 +1125,14 @@ const CauseColumns =[
     inputType: "Textarea",
     isShow:true,
    },
+   {
+    key: "sysFileRecordList",
+    title: "附件",
+    inputType: "Upload",
+    // fileType: ["pdf",""],
+    span:24,
+    isShow:true,
+  },
 ];
 const CauseTabColumns =[
   {