食堂管理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,12 +261,24 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="食堂图片"> <el-form-item label="食堂图片">
<el-upload <el-upload
action="" :http-request="
list-type="picture-card" (obj) => imgUpLoad(obj, 'fileUrl')
:on-preview="handlePictureCardPreview" "
:on-remove="handleRemove"> action="#"
<i class="el-icon-plus"></i> :limit="1"
</el-upload> :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 avatar-uploader-icon"
></i>
</el-upload>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -274,11 +286,20 @@
</el-form> </el-form>
</el-tab-pane> </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> </el-tabs>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -343,8 +364,8 @@
<script> <script>
import { systemAreaTreeApi } from "@/api/base/area"; 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 { export default {
name: "", name: "",
dicts: [], dicts: [],
@ -403,13 +424,16 @@
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}, },
jobTableData:[],
// //
dialogTotal: 0, dialogTotal: 0,
fileList: [],
checkUrlList: [],
checkUrlNameList: [],
dialogVisible:false, dialogVisible:false,
dialogImageUrl:"", dialogImageUrl:"",
}; };
@ -419,6 +443,7 @@
this.getList(); this.getList();
this.getCanteenLabel() this.getCanteenLabel()
this.queryAllCustJob() this.queryAllCustJob()
this.getMealtimeList()
}, },
methods: { methods: {
// //
@ -466,11 +491,16 @@
this.open = true; this.open = true;
this.title = "新增"; this.title = "新增";
}, },
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.baseForm = {};
this.resetForm("baseForm");
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
@ -490,37 +520,45 @@
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.baseForm = {};
this.resetForm("baseForm");
},
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["baseForm"].validate(valid => { this.$refs["baseForm"].validate(valid => {//
if (valid) { if (valid) {
if (this.baseForm.dictId != undefined) {
// updateType(this.baseForm).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
} else {
// addType(this.baseForm).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
}
if (this.baseForm.dictId != undefined) {
// updateType(this.baseForm).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
} else {
// addType(this.baseForm).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
}
} }
}); });
}, },
// //
getCanteenLabel() { getCanteenLabel() {
let param = { "current": 1,"size": -1} let param = { "current": 1,"size": -1}
@ -540,11 +578,12 @@
console.log(response) console.log(response)
}); });
}, },
//-
handleDialogQuery(){ handleDialogQuery(){
this.dialogQueryParams.pageNum=1 this.dialogQueryParams.pageNum=1
this.queryCustJobPage() this.queryCustJobPage()
}, },
//- //-
queryCustJobPage() { queryCustJobPage() {
let param = { let param = {
"current": this.dialogQueryParams.pageNum, "current": this.dialogQueryParams.pageNum,
@ -564,8 +603,53 @@
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
this.dialogImageUrl = file.url; this.dialogImageUrl = file.url;
this.dialogVisible = true; 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)
});
},