!308 修改宽度

Merge pull request !308 from 德仔/develop
This commit is contained in:
德仔 2021-07-06 04:12:49 +00:00 committed by Gitee
commit 75f8934252

View File

@ -221,14 +221,6 @@ export default {
},
handleOnExportStartNumConfig() {
this.oriStartNum = this.recipesData[0].numDay;
// this.$prompt("", "", {
// confirmButtonText: "",
// inputValue: this.oriStartNum,
// inputPattern: /^[1-9]\d*$/,
// inputErrorMessage: "",
// }).then(({ value }) => {
// this.handleOnExportImg(parseInt(value));
// });
this.$refs.exportDialogRef.showDialog({
num: this.oriStartNum,
});
@ -239,7 +231,6 @@ export default {
this.$message.warning("食谱导出中,请勿操作界面...");
//
this.downloading = true;
this.$nextTick(() => {
const centerContentDom = document.getElementById("center_content");
if (!centerContentDom) {
this.downloading = false;
@ -251,6 +242,9 @@ export default {
this.downloading = false;
return;
}
recipesDom.style.overflow = "visible";
recipesDom.style.width = this.getRecipesDomWidth(exportCols);
setTimeout(() => {
Array.from({ length: this.recipesData.length }).forEach((_, idx) => {
const tmpElm = document.getElementById(`cus_name_${idx}`);
if (tmpElm) {
@ -261,7 +255,7 @@ export default {
tmpNum.innerText = `${startNum + idx}`;
}
});
recipesDom.style.overflow = "visible";
html2canvans(recipesDom, {
scale: 1.5,
height: recipesDom.scrollHeight,
@ -278,6 +272,7 @@ export default {
centerContentDom.style.overflow = "auto";
recipesDom.style.overflow = "auto";
recipesDom.style.width = "unset";
Array.from({ length: this.recipesData.length }).forEach((_, idx) => {
const tmpElm = document.getElementById(`cus_name_${idx}`);
@ -295,7 +290,26 @@ export default {
this.downloading = false;
this.$message.success("食谱导出成功");
});
}, 500);
},
getRecipesDomWidth(cols) {
let width = 80;
cols.forEach((col) => {
if (
col === "菜品" ||
col === "食材" ||
col === "做法" ||
col === "备注"
) {
width += 220;
} else if (col === "分量估算" || col === "重量(g)") {
width += 80;
} else {
width += 60;
}
});
return `${width}px`;
},
...mapActions(["saveRecipes", "updateReviewStatus"]),
...mapMutations([