Merge branch 'master' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
@ -352,6 +352,7 @@
|
||||
:on-success="handleOnUploadSuccess"
|
||||
:on-exceed="handleOnUploadExceed"
|
||||
:on-remove="handleOnUploadRemove"
|
||||
:on-preview="handleOnUploadPreview"
|
||||
list-type="picture"
|
||||
>
|
||||
<em class="el-icon-upload" />
|
||||
@ -408,6 +409,17 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 预览弹窗 -->
|
||||
<el-dialog
|
||||
:visible.sync="previewVisible"
|
||||
:title="previewTitle"
|
||||
class="preview_dialog_wrapper"
|
||||
>
|
||||
<div class="preview_content">
|
||||
<img :src="previewUrl" alt="" class="preview_img" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -437,6 +449,7 @@ export default {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
|
||||
//
|
||||
actionUrl: process.env.VUE_APP_BASE_API + "/custom/fileUpload/ingredient",
|
||||
// 选中数组
|
||||
@ -480,6 +493,10 @@ export default {
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {},
|
||||
//
|
||||
previewVisible: false,
|
||||
previewUrl: "",
|
||||
previewTitle: "",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -704,6 +721,23 @@ export default {
|
||||
type: "warning",
|
||||
});
|
||||
},
|
||||
handleOnUploadPreview(file) {
|
||||
console.log(file);
|
||||
this.previewTitle = file.name;
|
||||
this.previewVisible = true;
|
||||
this.previewUrl = file.url;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.preview_dialog_wrapper {
|
||||
.preview_content {
|
||||
text-align: center;
|
||||
.preview_img {
|
||||
max-height: 600px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -38,7 +38,7 @@
|
||||
<div class="summary">
|
||||
<div style="font-size: 12px; color: #606266">总热量约等于</div>
|
||||
<div style="color: #515a6e; font-weight: bold">
|
||||
{{ totalHeat.toFixed(1) }}千卡
|
||||
{{ data[0] ? data[0].totalHeat.toFixed(1) : 0 }}千卡
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -82,7 +82,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
chart: null,
|
||||
totalHeat: 0,
|
||||
nameDict: {
|
||||
p: "蛋白质",
|
||||
f: "脂肪",
|
||||
@ -107,15 +106,15 @@ export default {
|
||||
mData() {
|
||||
const [data] = this.data;
|
||||
if (!data) {
|
||||
this.totalHeat = 0;
|
||||
return [];
|
||||
}
|
||||
this.totalHeat = data.cHeat + data.fHeat + data.pHeat;
|
||||
const mData = ["Weight", "Rate"].map((t, idx) => ({
|
||||
type: this.typeDict[t],
|
||||
...["p", "f", "c"].reduce((obj, cur) => {
|
||||
obj[cur] = idx
|
||||
? `${((data[`${cur}Heat`] / this.totalHeat) * 100).toFixed(2)}%`
|
||||
? data.totalHeat === 0
|
||||
? 0
|
||||
: `${((data[`${cur}Heat`] / data.totalHeat) * 100).toFixed(2)}%`
|
||||
: `${data[`${cur}Weight`].toFixed(1)}克`;
|
||||
return obj;
|
||||
}, {}),
|
||||
@ -199,7 +198,9 @@ export default {
|
||||
top: 18,
|
||||
left: 8,
|
||||
style: {
|
||||
text: `${this.totalHeat.toFixed(1)}千卡`,
|
||||
text: `${
|
||||
data.totalHeat ? data.totalHeat.toFixed(1) : 0
|
||||
}千卡`,
|
||||
font: '14px "Microsoft YaHei", sans-serif',
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user