食堂管理2

This commit is contained in:
zzyuan 2025-03-05 15:21:18 +08:00
parent d4e8ec7884
commit db41f94803
2 changed files with 216 additions and 44 deletions

88
src/api/system/upload.js Normal file
View File

@ -0,0 +1,88 @@
import request from '@/utils/request'
//资源图片上传
export function imgUpLoad(param){
const formData = new FormData()
formData.append('file', param.file)
formData.append('fileType', param.type)
return request({
url: '/system/sys/file/upload',
method: 'post',
data: formData,
header:'multipart/form-data'
})
}
export function imgUpLoadTwo(param){
const formData = new FormData()
formData.append('file', param.file)
formData.append('fileType', param.type)
return request({
url: '/file/upload',
method: 'post',
data: formData,
header:'multipart/form-data'
})
}
export function imgUpLoadThree(param){
const formData = new FormData()
param.forEach(item => {
formData.append('files', item)
})
// formData.append('files', param)
return request({
url: '/file/uploadFiles',
method: 'post',
data: formData,
header:'multipart/form-data'
})
}
//资源文件上传
export function fileUpLoad(param){
const formData = new FormData()
formData.append('file', param.file)
return request({
url: '/system/sys/file/upload',
method: 'post',
data: formData,
})
}
// excel文件上传
export function excelUpLoad(param){
const formData = new FormData()
formData.append('file', param.file)
return request({
url: '/material/base/maPartType/readExcel',
method: 'post',
data: formData,
})
}
// excel文件下载
export function downloadExcel(param){
return request({
url: '/material/base/maPartType/downLoad',
method: 'post',
param
})
}

View File

@ -261,11 +261,23 @@
<el-col :span="12">
<el-form-item label="食堂图片">
<el-upload
action=""
:http-request="
(obj) => imgUpLoad(obj, 'fileUrl')
"
action="#"
:limit="1"
:file-list="fileList"
:show-file-list="true"
list-type="picture-card"
accept=".png, .jpg, .jpeg"
:on-success="handleAvatarSuccess"
:class="{ disabled: uploadDisabled }"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
:on-remove="handleRemove"
>
<i
class="el-icon-plus avatar-uploader-icon"
></i>
</el-upload>
</el-form-item>
</el-col>
@ -274,11 +286,20 @@
</el-form>
</el-tab-pane>
<!-- 支付设置 -->
<el-tab-pane label="支付设置" name="paySetting"></el-tab-pane>
<el-tab-pane label="支付设置" name="paySetting">
支付设置
</el-tab-pane>
<!-- 配送设置 -->
<el-tab-pane label="配送设置" name="deliverySetting"></el-tab-pane>
<el-tab-pane label="配送设置" name="deliverySetting">
配送设置
</el-tab-pane>
<!-- 预订/点餐/报餐设置 -->
<el-tab-pane label="预订/点餐/报餐设置" name="orderSetting"></el-tab-pane>
<el-tab-pane label="预订/点餐/报餐设置" name="orderSetting">
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
@ -343,8 +364,8 @@
<script>
import { systemAreaTreeApi } from "@/api/base/area";
import { getPageCanteenApi,getCanteenLabelApi,queryAllCustJobApi,queryCustJobPageApi } from "@/api/base/canteen";
import { getPageCanteenApi,getCanteenLabelApi,queryAllCustJobApi,queryCustJobPageApi,getMealtimeListApi,addCanteenApi } from "@/api/base/canteen";
import { imgUpLoadTwo } from '@/api/system/upload'
export default {
name: "",
dicts: [],
@ -403,13 +424,16 @@
pageNum: 1,
pageSize: 10,
},
jobTableData:[],
//
dialogTotal: 0,
fileList: [],
checkUrlList: [],
checkUrlNameList: [],
dialogVisible:false,
dialogImageUrl:"",
};
@ -419,6 +443,7 @@
this.getList();
this.getCanteenLabel()
this.queryAllCustJob()
this.getMealtimeList()
},
methods: {
//
@ -466,11 +491,16 @@
this.open = true;
this.title = "新增";
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.baseForm = {};
this.resetForm("baseForm");
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
@ -490,20 +520,27 @@
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.baseForm = {};
this.resetForm("baseForm");
},
/** 提交按钮 */
submitForm: function() {
this.$refs["baseForm"].validate(valid => {
this.$refs["baseForm"].validate(valid => {//
if (valid) {
if (this.baseForm.dictId != undefined) {
// updateType(this.baseForm).then(response => {
// this.$modal.msgSuccess("");
@ -521,6 +558,7 @@
});
},
//
getCanteenLabel() {
let param = { "current": 1,"size": -1}
@ -540,11 +578,12 @@
console.log(response)
});
},
//-
handleDialogQuery(){
this.dialogQueryParams.pageNum=1
this.queryCustJobPage()
},
//-
//-
queryCustJobPage() {
let param = {
"current": this.dialogQueryParams.pageNum,
@ -564,7 +603,52 @@
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
//
imgUpLoad(param, name, index) {
// console.log(param,'image')
param.type = 'canteen'
imgUpLoadTwo(param).then((res) => {
if (res.code == 200) {
this.checkUrlList.push(res.data.fileUrl)
this.checkUrlNameList.push(res.data.fileName)
} else {
this.$modal.msgError(res.msg)
}
})
.catch((error) => {
this.$modal.msgError(error)
})
},
handleAvatarSuccess(res, file) {
console.log('success')
},
handleExceed(files, fileList) {
this.$message.warning('最多只可以上传一张图片')
},
handleRemove(file, fileList) {
let sum = 0
this.checkUrlNameList.forEach((item, index) => {
if (item == file.name) {
sum = index
}
})
this.checkUrlNameList.splice(sum, 1)
this.checkUrlList.splice(sum, 1)
},
//
handlePictureCardPreview(file) {
console.log(file)
this.dialogImageUrl = file.url
this.dialogVisible = true
},
//
getMealtimeList() {
getMealtimeListApi({}).then((response) => {
console.log(response)
});
},