瀏覽代碼

bug修复

chenrui 3 年之前
父節點
當前提交
e0e5838787

+ 8 - 3
src/components/UploadFile/index.vue

@@ -7,6 +7,7 @@
       :disabled="disabled"
       @preview="handlePreview"
       @change="handleChange"
+      :remove="handleRemove"
       :beforeUpload="beforeUpload"
       :data="params"
       :headers="headers"
@@ -146,11 +147,15 @@ export default {
       this.previewImage = file.url || file.thumbUrl
       this.previewVisible = true
     },
+    handleRemove (file) {
+      this.$emit('remove')
+    },
     handleChange ({ file, fileList }) {
       // console.log(file, fileList, '-----change')
-      if (file.response && (file.response.status == 500)) {
+      if (file.response && (file.response.status == 500 || file.response.status == 900)) {
         if (file.status == 'error' || file.status == 'done') {
           this.$message.error(file.response.message || '上传失败,请重试!')
+          this.$emit('remove')
           return
         }
       }
@@ -215,11 +220,11 @@ export default {
       }
       const isType = this.fileType.indexOf(file.type) >= 0 && file.type != ''
       // 文件格式限制为.xls、.xlsx时,上传.csv文件的type为application/vnd.ms-excel,与.xls一致,无法限制,因此更改为:
-      if (!isType || file.name.indexOf('.csv')>=0) {
+      if (!isType || file.name.indexOf('.csv') >= 0) {
         if (tip != 0) {
           this.$message.error('请上传正确的格式!')
         }
-        return isType && !(file.name.indexOf('.csv')>=0)
+        return isType && !(file.name.indexOf('.csv') >= 0)
       }
       // if (!isType) {
       //   if (tip != 0) {

+ 1 - 0
src/views/bulkManagement/bulkImport/list.vue

@@ -11,6 +11,7 @@
           :action="attachAction"
           :uploadParams="uploadParams"
           upText="选择导入文件"
+          @remove="resetSearchForm"
           @change="changeImport"></Upload>
         <a :href="filePath" style="margin: 5px 0 0 15px;display: block;float: left;">
           <a-icon type="download" style="padding-right: 5px;" />下载导入模板

+ 9 - 10
src/views/inventoryManagement/inventoryImport/list.vue

@@ -11,6 +11,7 @@
           :action="attachAction"
           :uploadParams="uploadParams"
           upText="选择导入文件"
+          @remove="resetSearchForm"
           @change="changeImport"></Upload>
         <a :href="filePath" style="margin: 5px 0 0 15px;display: block;float: left;">
           <a-icon type="download" style="padding-right: 5px;" />下载导入模板
@@ -40,7 +41,7 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
-        :scroll="{ x: 1680, y: tableHeight }"
+        :scroll="{ y: tableHeight }"
         :defaultLoadData="false"
         bordered>
       </s-table>
@@ -83,13 +84,13 @@ export default {
       isAllError: false, // 是否全部错误
       // 表头
       columns: [
-        { title: '序号', dataIndex: 'no', width: 50, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '入库数量', dataIndex: 'putQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '成本价', dataIndex: 'cost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '错误原因', dataIndex: 'errorMsg', width: 150, align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库', dataIndex: 'warehouseName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入库数量', dataIndex: 'putQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '成本价', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '错误原因', dataIndex: 'errorMsg', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -173,8 +174,6 @@ export default {
         }
       })
     },
-    // 下载模板
-    handleExport () {},
     // 导出错误项
     handleExportError () {
       const _this = this