feat: #10000 数据加载显示优化

This commit is contained in:
赵世界 2022-09-19 13:21:36 +08:00
parent 5f3c64ed88
commit c11353f4d9
2 changed files with 28 additions and 6 deletions

View File

@ -64,7 +64,8 @@
<el-button type="primary" plain @click="update()">上新</el-button> <el-button type="primary" plain @click="update()">上新</el-button>
<el-upload ref="myUpload" action="/api/inventory/goods_skus" :multiple="false" <el-upload ref="myUpload" action="/api/inventory/goods_skus" :multiple="false"
name="inventoryFile" :show-file-list="false" :on-success="inventorySuccess" name="inventoryFile" :show-file-list="false" :on-success="inventorySuccess"
:on-error="inventoryError" style="display:inline-block;margin: 0 10px 0 10px;"> :before-upload="beforeInventory" :on-error="inventoryError"
style="display:inline-block;margin: 0 10px 0 10px;">
<el-button type="primary" plain>盘点导入</el-button> <el-button type="primary" plain>盘点导入</el-button>
</el-upload> </el-upload>
<el-button type="primary" plain @click="addNewgoods">新建商品</el-button> <el-button type="primary" plain @click="addNewgoods">新建商品</el-button>
@ -491,6 +492,7 @@ export default {
publicId: "", // id publicId: "", // id
reference_price: "", // reference_price: "", //
reserve: "", // reserve: "", //
loadingModule: ""
}; };
}, },
methods: { methods: {
@ -907,17 +909,27 @@ export default {
this.brand = res.data.data; this.brand = res.data.data;
}); });
}, },
beforeInventory() {
this.loadingModule = this.$loading({
lock: true,
text: '盘点导入中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
},
inventorySuccess(response) { inventorySuccess(response) {
this.$message({ this.$message({
message: response.message, message: response.message,
type: "success", type: "success",
}); });
this.loadingModule.close();
}, },
inventoryError(err) { inventoryError(err) {
this.$message({ this.$message({
message: res.errorMessage, message: err.errorMessage,
type: "error", type: "error",
}); });
this.loadingModule.close();
} }
}, },

View File

@ -17,7 +17,7 @@
</el-button> </el-button>
<div v-if="scope.row.status === '已授权'"> <div v-if="scope.row.status === '已授权'">
<el-button type="success" :disabled="true">{{ <el-button type="success" :disabled="true">{{
scope.row.status scope.row.status
}}</el-button> }}</el-button>
<el-button @click="download(scope.row)">下载商品</el-button> <el-button @click="download(scope.row)">下载商品</el-button>
</div> </div>
@ -30,9 +30,8 @@
<div v-if="scope.row.status === '无需授权'"> <div v-if="scope.row.status === '无需授权'">
<el-button type="success" :disabled="true">{{ <el-button type="success" :disabled="true">{{
scope.row.status scope.row.status
}}</el-button> }}</el-button>
<el-button @click="download(scope.row)">下载商品</el-button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -148,8 +147,18 @@ export default {
// //
download(row) { download(row) {
const loading = this.$loading({
lock: true,
text: row.name + ' 店铺商品下载中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
downloadGoods(row.id).then((res) => { downloadGoods(row.id).then((res) => {
loading.close();
this.$message({
type: "success",
message: res.data.message,
});
}); });
}, },
}, },
@ -161,6 +170,7 @@ a {
text-decoration: none; text-decoration: none;
color: white; color: white;
} }
.block { .block {
margin-top: 20px; margin-top: 20px;
} }