问题优化修改

This commit is contained in:
zzyuan 2025-12-29 09:40:43 +08:00
parent 35e47bc019
commit b806b96c97
4 changed files with 400 additions and 10 deletions

Binary file not shown.

View File

@ -302,7 +302,7 @@
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmCopyMenu"></el-button>
<el-button type="primary" @click="confirmCopyMenu">复制菜谱</el-button>
<el-button @click="openCopyMenu=false"> </el-button>
</div>
</el-dialog>

View File

@ -96,6 +96,14 @@
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
size="mini" type="primary"
@click="handleImportRecharge"
>导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -208,14 +216,127 @@
@pagination="getList"
/>
<!-- 导入充值对话框 -->
<el-dialog title="导入充值" :visible.sync="openImport" width="600px" append-to-body>
<div style="padding: 20px;">
<!-- 下载模板区域 -->
<div style="margin-bottom: 30px; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 8px; text-align: center;">
<i class="el-icon-download" style="font-size: 48px; color: #fff; margin-bottom: 10px;"></i>
<div style="color: #fff; font-size: 16px; margin-bottom: 15px;">下载补贴充值导入模板</div>
<el-button type="primary" size="mini" @click="downloadTemplate" style="background: #fff; color: #667eea; border: none;">
<i class="el-icon-download"></i> 下载模板
</el-button>
</div>
<!-- 文件上传区域 -->
<div style="margin-bottom: 20px;">
<div style="font-size: 14px; color: #606266; margin-bottom: 10px; font-weight: 500;">
<i class="el-icon-upload2"></i> 上传文件
</div>
<el-upload
ref="upload"
:on-change="handleFileChange"
:file-list="fileList"
:auto-upload="false"
:limit="1"
:disabled="fileList.length > 0"
accept=".xlsx,.xls"
drag
style="width: 100%;"
>
<i class="el-icon-upload" style="font-size: 67px; color: #C0C4CC; margin: 40px 0 16px;"></i>
<div class="el-upload__text" style="color: #606266;">
将文件拖到此处<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip" style="color: #909399; font-size: 12px; margin-top: 10px;">
只能上传 Excel 文件.xlsx/.xls且不超过 10MB
</div>
</el-upload>
</div>
<!-- 上传进度 -->
<div v-if="uploadProgress > 0 && uploadProgress < 100" style="margin-bottom: 20px;">
<el-progress :percentage="uploadProgress" :status="uploadProgress === 100 ? 'success' : ''"></el-progress>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleImportCancel"> </el-button>
<el-button type="primary" @click="submitUpload" :loading="uploading">开始上传</el-button>
</div>
</el-dialog>
<!-- 补贴充值预览对话框 -->
<el-dialog title="补贴充值预览" :visible.sync="openImportPreview" width="1200px" append-to-body>
<div style="margin-bottom: 10px; text-align: center;" v-if="importPreviewData.errMsg !=null && importPreviewData.errMsg !=''">
表头错误日志{{ importPreviewData.errMsg || '无' }}
</div>
<div style="margin-bottom: 10px; text-align: center;">
总记录数{{ importPreviewData.totalCount || '--' }}
有效记录数{{ importPreviewData.successNum || '--' }}
导入数量{{ importPreviewData.totalNum }}
导入金额{{ (importPreviewData.validTotalAmount/100).toFixed(2) }}
无效记录数{{ importPreviewData.errorNum || '--' }}
</div>
<div v-if="importPreviewData.errorList && importPreviewData.errorList.length > 0" style="margin-bottom: 20px;">
<div style="font-weight: 600; margin-bottom: 10px;">无效记录</div>
<el-table :data="importPreviewData.errorList" max-height="250">
<!-- <el-table-column label="行号" align="center" prop="row" width="80" :show-overflow-tooltip="true" /> -->
<el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="失败原因" align="center" prop="errorMessage" :show-overflow-tooltip="true"/>
</el-table>
</div>
<div v-if="importPreviewData.successVoList && importPreviewData.successVoList.length > 0">
<div style="font-weight: 600; margin-bottom: 10px;">有效记录</div>
<el-table :data="importPreviewData.successVoList" max-height="250">
<el-table-column label="序号" align="center" width="80" type="index" />
<!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> -->
<el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" />
<el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span>
<span v-if="!scope.row.salesMode">/</span>
</template>
</el-table-column>
<el-table-column label="单价(元)" align="center" prop="singlePrice" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="scope.row.singlePrice" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.singlePrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="orderNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model.number="scope.row.orderNum" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.orderNum=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template>
</el-table-column>
<el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ (scope.row.orderNum*scope.row.singlePrice).toFixed(2) }}</span>
<!-- <span v-if="scope.row.singlePrice>=0">{{ PrecisionHandler.multiply(scope.row.orderNum,scope.row.singlePrice) }}</span> -->
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="请输入" maxlength="20" clearable/>
</template>
</el-table-column>
</el-table>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmImportSubmit" v-if="importPreviewData.errorList.length==0 && importPreviewData.errMsg =='' ">确认</el-button>
<el-button @click="openImportPreview=false">取消</el-button>
</div>
</el-dialog>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -229,6 +350,10 @@
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { supplierPageApi } from "@/api/foodManage/purchaseManage";
import { purchaseOrderPageApi,getPurchaseOrderInfoApi,delPurchaseOrderApi,finishPurchaseOrderApi,addPurchaseInspectApi } from "@/api/foodManage/purchaseManage";
import {downloadFileByUrl} from "@/utils/download";
import request from "@/utils/request";
import {getToken} from "@/utils/auth";
import {decryptWithSM4} from "@/utils/sm";
export default {
name: "",
@ -301,6 +426,23 @@ export default {
// dictType: [
// { required: true, message: "", trigger: "blur" }
// ]
},
//
openImport: false,
fileList: [],
uploadProgress: 0,
uploading: false,
openImportPreview: false,
importPreviewData: {
totalCount: 0,
totalNum:0,
validTotalAmount:0,
successVoList:[],
errorList:[],
successNum:0,
errorNum:0,
errMsg:'',
orderStatus:1
}
};
},
@ -516,7 +658,254 @@ export default {
const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
const seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
//
handleImportRecharge() {
this.openImport = true;
this.fileList = [];
this.uploadProgress = 0;
this.uploading = false;
this.importPreviewData = {
totalCount: 0,
totalNum:0,
validTotalAmount:0,
successVoList:[],
errorList:[],
successNum:0,
errorNum:0,
errMsg:'',
orderStatus:1
};
if (this.$refs.upload) {
this.$refs.upload.clearFiles();
}
},
//
handleFileChange(file, fileList) {
//
if (fileList.length > 1) {
this.fileList = [fileList[fileList.length - 1]];
this.$refs.upload.fileList = [fileList[fileList.length - 1]];
} else {
this.fileList = fileList;
}
},
//
downloadTemplate() {
let url = window.location.origin + '/template/采购订单导入模版.xlsx';
console.log(url)
downloadFileByUrl(url)
},
//
beforeUpload(file) {
const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
file.type === 'application/vnd.ms-excel' ||
file.name.endsWith('.xlsx') ||
file.name.endsWith('.xls');
const isLt10M = file.size / 1024 / 1024 < 10;
if (!isExcel) {
this.$modal.msgError('只能上传 Excel 文件!');
return false;
}
if (!isLt10M) {
this.$modal.msgError('上传文件大小不能超过 10MB');
return false;
}
return true;
},
//
handleUploadProgress(event, file, fileList) {
this.uploadProgress = Math.round(event.percent);
},
//
handleUploadSuccess(response, file, fileList) {
this.uploading = false;
this.uploadProgress = 100;
//
const result = response.data || response;
if (response.code === 200 || response.code === 0 || !response.code) {
this.uploadResult = {
success: true,
data: result,
message: response.msg || response.message || '导入成功'
};
this.$modal.msgSuccess('导入成功!');
//
setTimeout(() => {
this.getList();
}, 500);
} else {
this.uploadResult = {
success: false,
data: result,
message: response.msg || response.message || '导入失败'
};
this.$modal.msgError(response.msg || response.message || '导入失败');
}
},
//
handleUploadError(err, file, fileList) {
this.uploading = false;
this.uploadProgress = 0;
this.uploadResult = {
success: false,
message: err.message || '上传失败,请重试'
};
this.$modal.msgError('上传失败,请重试');
},
//
submitUpload() {
if (this.fileList.length === 0) {
this.$modal.msgError('请先选择要上传的文件!');
return;
}
const file = this.fileList[0].raw || this.fileList[0];
if (!file) {
this.$modal.msgError('文件不存在,请重新选择!');
return;
}
//
const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
file.type === 'application/vnd.ms-excel' ||
file.name.endsWith('.xlsx') ||
file.name.endsWith('.xls');
const isLt10M = file.size / 1024 / 1024 < 10;
if (!isExcel) {
this.$modal.msgError('只能上传 Excel 文件!');
return;
}
if (!isLt10M) {
this.$modal.msgError('上传文件大小不能超过 10MB');
return;
}
this.uploading = true;
this.uploadProgress = 0;
// 使FormData
const formData = new FormData();
formData.append('file', file);
//
request({
url: '/smart-canteen/ims_order_goods/import/add/check',
method: 'post',
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
'Authorization': 'Bearer ' + getToken()
},
onUploadProgress: (progressEvent) => {
if (progressEvent.total) {
this.uploadProgress = Math.round((progressEvent.loaded * 100) / progressEvent.total);
}
}
}).then(response => {
this.uploading = false;
this.uploadProgress = 100;
//
const result = response.data || response;
if (response.code === 200 || response.code === 0) {
//
const amountMap = {};
(result.sucVoListMap || []).forEach(item => {
const key = Object.keys(item || {})[0];
if (key) {
amountMap[key] = item[key];
}
});
const successVoList = result.cookMaterialList;
const errorList = result.errorList;
const totalCount = successVoList.length+errorList.length;
const totalNum = result.totalNum;
const validTotalAmount = result.orderAmount;
const successNum = successVoList.length;
const errorNum = errorList.length;
//
const errMsg = result.errMsg;
this.importPreviewData = {
...result,
totalCount: totalCount,
totalNum:totalNum,
validTotalAmount:validTotalAmount,
successVoList:successVoList,
errorList:errorList,
successNum:successNum,
errorNum:errorNum,
errMsg:errMsg,
orderStatus:1
};
//
this.openImport = false;
this.openImportPreview = true;
} else {
this.$modal.msgError(response.msg || response.message || '校验失败');
}
}).catch(error => {
this.uploading = false;
this.uploadProgress = 0;
this.$modal.msgError(error.message || '上传失败,请重试');
});
},
//
confirmImportSubmit() {
if (!this.importPreviewData.successVoList === 0) {
this.$modal.msgError('没有有效的记录可以提交!');
return;
}
this.importPreviewData = {
...this.importPreviewData,
orderGoodsDetailList:this.importPreviewData.successVoList
}
//
request({
url: '/smart-canteen/ims_order_goods',
method: 'post',
data: {...this.importPreviewData},
headers: {
'Authorization': 'Bearer ' + getToken()
}
}).then(response => {
if (response.code === 200 || response.code === 0) {
this.$modal.msgSuccess("操作成功");
this.openImportPreview = false;
this.getList();
} else {
this.$modal.msgError(response.msg || response.message || '提交失败');
}
}).catch(error => {
this.$modal.msgError(error.message || '提交失败,请重试');
});
},
//
handleImportCancel() {
this.openImport = false;
this.fileList = [];
this.uploadProgress = 0;
this.uploading = false;
this.importPreviewData = {
totalCount: 0,
totalNum:0,
validTotalAmount:0,
successVoList:[],
errorList:[],
successNum:0,
errorNum:0,
errMsg:'',
orderStatus:1
};
if (this.$refs.upload) {
this.$refs.upload.clearFiles();
}
},
},
};
</script>

View File

@ -84,7 +84,7 @@
@pagination="getList"
/>
<el-dialog :visible.sync="dialogVisible" width="1000px" title="晨检视频">
<el-dialog :visible.sync="dialogVisible" width="1000px" title="晨检视频" v-if="dialogVisible">
<video v-if="dialogVideoUrl" style="width: 100%; height: 600px; object-fit: contain;" controls>
<source :src="dialogVideoUrl" type="video/mp4">
您的浏览器不支持视频播放
@ -187,6 +187,7 @@ export default {
});
},
openVideo(row){
console.log("videoUrl", row.checkVideoUrl)
this.dialogVideoUrl = row.checkVideoUrl;
this.dialogVisible = true;
},